ci: build debug APK and publish release on tag via GitHub Actions #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 APK | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Build debug APK | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew :app:assembleDebug --stacktrace --no-daemon | |
| - name: Stage APK | |
| run: | | |
| mkdir -p out | |
| cp app/build/outputs/apk/debug/app-debug.apk "out/OVERWATCH-${GITHUB_REF_NAME}.apk" | |
| # Uploaded on every run (incl. workflow_dispatch) so a build can be | |
| # validated without cutting a release. | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: overwatch-apk | |
| path: out/*.apk | |
| # Only tag pushes (v*) create a GitHub Release with the APK attached. | |
| - name: Publish Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: out/*.apk | |
| generate_release_notes: true |