Create release v3.11.0 #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create-Release | |
run-name: Create release ${{github.ref_name}} | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
Build-and-Test: | |
uses: ./.github/workflows/build-test.yml | |
permissions: | |
contents: write | |
pull-requests: write | |
security-events: write | |
Release: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
permissions: | |
contents: write | |
id-token: write | |
attestations: write | |
needs: | |
- Build-and-Test | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set variables | |
run: | | |
version="$(echo '${{github.ref_name}}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" | |
echo VERSION="$version" >> $GITHUB_ENV | |
echo TAG="v${version}" >> $GITHUB_ENV | |
echo TITLE="Version ${version}" >> $GITHUB_ENV | |
- name: Check version | |
run: | | |
version="${{env.VERSION}}" | |
echo 'Checking versionName ...' | |
[ ! -z "$(grep -E 'versionName\s?=' app/build.gradle | grep -F "$version")" ] | |
echo 'versionName is correct.' | |
major="$(cut -d'.' -f1 <<<"$version")" | |
minor="$(cut -d'.' -f2 <<<"$version")" | |
patch="$(cut -d'.' -f3 <<<"$version")" | |
versionCode="$(printf '%i%02i%02i' "$major" "$minor" "$patch")" | |
echo 'Checking versionCode ...' | |
[ ! -z "$(grep -E 'versionCode\s?=' app/build.gradle | grep -F "$versionCode")" ] | |
echo 'versionCode is correct.' | |
- name: Check release_notes.md version | |
run: | | |
for v in $(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' .github/workflows/resources/release_notes.md); do \ | |
grep -qF "${{env.VERSION}}" <<<"$v"; \ | |
done | |
- name: Set up JDK 19 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '19' | |
distribution: 'temurin' | |
- name: Set gradle.properties | |
env: | |
PROPERTIES_BASE64: ${{ secrets.PROPERTIES_BASE64 }} | |
run: | | |
mkdir -p ~/.gradle | |
echo "$PROPERTIES_BASE64" | base64 --decode >~/.gradle/gradle.properties | |
- name: Set KeyStore | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
run: echo "$KEYSTORE_BASE64" | base64 --decode >keyStore.jks | |
- name: Build APK | |
run: | | |
chmod +x gradlew | |
./gradlew assembleRelease | |
mkdir release | |
mv app/build/outputs/apk/latest/release/*.apk "release/clip_share_client.apk" | |
mv app/build/outputs/apk/legacy/release/*.apk "release/clip_share_client-legacy.apk" | |
cd release/ | |
sha256sum -b * >SHA2-256SUM | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-path: "release/SHA2-256SUM" | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
sed -i "s/<VERSION>/${{env.VERSION}}/g" .github/workflows/resources/release_notes.md | |
cd release | |
gh release create "${{env.TAG}}" --latest --verify-tag \ | |
--notes-file ../.github/workflows/resources/release_notes.md \ | |
--title "${{env.TITLE}}" * |