From c74b419c62d94bdf4f499abb5ce9c679a1dfd930 Mon Sep 17 00:00:00 2001 From: BinTianqi Date: Fri, 24 May 2024 21:37:32 +0800 Subject: [PATCH] ci: build release APK, add short SHA to artifact file name Co-authored-by: MinoriceOwO <154642983+minoriceowo@users.noreply.github.com> --- .github/workflows/build.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e914e5c..98a88bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Debug APK +name: Build APK on: push: @@ -20,14 +20,26 @@ jobs: distribution: 'adopt' java-version: '21' + - name: Get short commit SHA + run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV + - name: Grant execution permission to Gradle Wrapper run: chmod +x gradlew - - name: Build with Gradle + - name: Build Debug APK run: ./gradlew assembleDebug - - name: Upload artifact + - name: Upload Debug APK uses: actions/upload-artifact@v4 with: - name: app-debug.apk + name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-testkey.apk + path: app/build/outputs/apk/debug/app-debug.apk + + - name: Build Release APK + run: ./gradlew assembleRelease + + - name: Upload Release APK + uses: actions/upload-artifact@v4 + with: + name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-testkey.apk path: app/build/outputs/apk/debug/app-debug.apk \ No newline at end of file