Update GitHub workflow to customize APK filename with TetriStats name and version

This commit is contained in:
cmclark00 2025-03-20 15:25:27 -04:00
parent d350cf190b
commit 782377408b

View file

@ -29,15 +29,6 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Release APK
run: ./gradlew assembleRelease
- name: Upload APK as artifact
uses: actions/upload-artifact@v4
with:
name: app-release
path: app/build/outputs/apk/release/app-release-unsigned.apk
- name: Get version name from build.gradle
id: version
run: |
@ -45,6 +36,35 @@ jobs:
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "APP_VERSION=$VERSION_NAME" >> $GITHUB_OUTPUT
- name: Build Release APK
run: ./gradlew assembleRelease
- name: Rename APK for tag release
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p renamed_apk
cp app/build/outputs/apk/release/app-release-unsigned.apk renamed_apk/TetriStats-${{ env.VERSION_NAME }}.apk
- name: Rename APK for push release
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' }}
run: |
mkdir -p renamed_apk
cp app/build/outputs/apk/release/app-release-unsigned.apk renamed_apk/TetriStats-${{ env.VERSION_NAME }}-${{ github.run_number }}.apk
- name: Upload APK as artifact for tag release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: TetriStats-${{ env.VERSION_NAME }}
path: renamed_apk/TetriStats-${{ env.VERSION_NAME }}.apk
- name: Upload APK as artifact for push release
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' }}
uses: actions/upload-artifact@v4
with:
name: TetriStats-${{ env.VERSION_NAME }}-${{ github.run_number }}
path: renamed_apk/TetriStats-${{ env.VERSION_NAME }}-${{ github.run_number }}.apk
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
@ -53,7 +73,7 @@ jobs:
name: Release ${{ env.VERSION_NAME }}
draft: false
prerelease: false
files: app/build/outputs/apk/release/app-release-unsigned.apk
files: renamed_apk/TetriStats-${{ env.VERSION_NAME }}.apk
body: |
TetriStats Android App Release v${{ env.VERSION_NAME }}
@ -70,7 +90,7 @@ jobs:
name: Release v${{ env.VERSION_NAME }}-${{ github.run_number }}
draft: false
prerelease: false
files: app/build/outputs/apk/release/app-release-unsigned.apk
files: renamed_apk/TetriStats-${{ env.VERSION_NAME }}-${{ github.run_number }}.apk
body: |
TetriStats Android App Release v${{ env.VERSION_NAME }}-${{ github.run_number }}