Upgrade version and version code #3
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
#file: noinspection SpellCheckingInspection | |
name: Publish release | |
on: | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: # fix git tag --format=... showing commit message instead of tag message | |
fetch-depth: 1 # despite being the default, it allows checking out a tag | |
ref: ${{ github.ref }} | |
- name: Abort if tag is not annotated | |
run: | | |
tag_type=$(git cat-file -t $GITHUB_REF) | |
if [ "$tag_type" != "tag" ]; then # if not annotated, tag_type is "commit" | |
echo "The tag $GITHUB_REF_NAME is not annotated. Aborting job." | |
exit 1 | |
fi | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: wrapper | |
- name: Run tests | |
run: ./gradlew testReleaseUnitTest | |
- name: Decode Keystore | |
env: | |
ENCODED_STRING: ${{ secrets.KEYSTORE }} | |
run: | | |
echo $ENCODED_STRING | base64 -di > app/keystore.jks | |
- name: Show signing report | |
env: | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
run: ./gradlew signingReport | |
- name: Build release APK | |
env: | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
run: ./gradlew :app:assembleRelease | |
- name: Clean up | |
if: ${{ !cancelled() }} | |
run: rm app/keystore.jks | |
- name: Make directory for release files | |
run: mkdir ./dist | |
- name: Compress proguard mappings | |
run: tar -C app/build/outputs/mapping/release -c . | zstd --ultra --long -22 -T0 > ./dist/proguard-mappings.tar.zst | |
- name: Rename apk | |
run: mv app/build/outputs/apk/release/app-release.apk ./dist/e621-$GITHUB_REF_NAME.apk | |
- name: Fetch release notes | |
run: git tag -l --format="%(contents)" $GITHUB_REF_NAME | tee ./release.txt | |
- name: Publish release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./dist/** | |
fail_on_unmatched_files: true | |
make_latest: true | |
body_path: "./release.txt" | |
generate_release_notes: true |