Build Release APK #2
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 Release APK | |
| concurrency: | |
| group: android-release-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-release-apk: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build release APK | |
| working-directory: android | |
| run: | | |
| chmod +x gradlew | |
| ./gradlew --no-daemon --console=plain --stacktrace :app:assembleRelease | |
| - name: Normalize APK artifact | |
| run: | | |
| apk_path=$(find android/app/build/outputs/apk/release -name '*.apk' | head -n 1) | |
| test -n "$apk_path" || { | |
| echo "Release APK not found"; | |
| exit 1; | |
| } | |
| cp "$apk_path" app-release.apk | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-release-apk | |
| path: app-release.apk | |
| - name: Create GitHub release | |
| if: github.ref == 'refs/heads/main' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: android-v${{ github.run_number }} | |
| name: Android Release v${{ github.run_number }} | |
| files: app-release.apk | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |