Update apk-artifact.yml #2
Workflow file for this run
This file contains hidden or 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: Build APKs (Artifact) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - '**' | |
| concurrency: | |
| group: apk-artifact-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Decode release keystore | |
| env: | |
| ENCODED_STRING: ${{ secrets.KEYSTORE_BASE64 }} | |
| run: | | |
| echo "$ENCODED_STRING" | base64 -d > release.jks | |
| - name: Generate debug keystore | |
| run: | | |
| keytool -genkeypair \ | |
| -keystore debug.keystore \ | |
| -storepass android \ | |
| -alias androiddebugkey \ | |
| -keypass android \ | |
| -keyalg RSA \ | |
| -keysize 2048 \ | |
| -validity 10950 \ | |
| -dname "CN=Android Debug,O=Android,C=US" | |
| - name: Run unit tests | |
| run: ./gradlew :app:testDebugUnitTest | |
| - name: Build debug APK | |
| run: ./gradlew :app:assembleDebug | |
| - name: Build signed release APK | |
| env: | |
| KEYSTORE_PATH: ${{ github.workspace }}/release.jks | |
| STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: ./gradlew :app:assembleRelease | |
| - name: Upload debug APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-debug | |
| path: app/build/outputs/apk/debug/*.apk | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: Upload signed release APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-release-signed | |
| path: app/build/outputs/apk/release/*.apk | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: Build summary | |
| if: always() | |
| run: | | |
| { | |
| echo "## APK build summary" | |
| echo "" | |
| echo "- **Branch / ref:** \`${{ github.ref }}\`" | |
| echo "- **Commit:** \`${{ github.sha }}\`" | |
| echo "" | |
| echo "Download the APKs from the *Artifacts* section at the bottom of this run page." | |
| } >> "$GITHUB_STEP_SUMMARY" |