Build APK (Test) #45
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 APK (Test) | |
| on: | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| build: | |
| name: Build APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Java and Android SDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Decode Keystore | |
| id: decode_keystore | |
| uses: timheuer/base64-to-file@v1 | |
| with: | |
| fileName: 'keystore/key.jks' | |
| encodedString: ${{ secrets.SIGN_KEY }} | |
| - name: Build GitHub Release APK | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew clean assembleProdRelease --no-build-cache --no-configuration-cache --no-daemon --rerun-tasks | |
| env: | |
| SIGNING_KEY_ALIAS: ${{ secrets.ALIAS }} | |
| SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| SIGNING_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
| - name: Extract Version Name and Version Code | |
| run: | | |
| # Extract versionName and versionCode from build.gradle | |
| VERSION_NAME=$(cat app/build.gradle | grep -oP 'versionName "\K[^"]*') | |
| VERSION_CODE=$(cat app/build.gradle | grep -oP 'versionCode \K\d+') | |
| echo "Version Name: $VERSION_NAME" | |
| echo "Version Code: $VERSION_CODE" | |
| # Set these values as environment variables for later steps | |
| echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV | |
| echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV | |
| - name: Archive APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.VERSION_NAME }} APKs | |
| path: app/build/outputs/apk/prod/release/app-prod-release.apk |