Add CI and release pipelines for Android APK builds

Mirrors the Holio setup:

- release.yml: on push to main (e.g. a merged PR), builds the debug APK
  and publishes it as a GitHub Release tagged v1.0.<run-number>.
- ci.yml: pre-merge checks on the dev branch and on PRs targeting dev or
  main — same build plus unit tests and lint, uploaded as artifacts only.

Both expect a Gradle Android project at the repo root with an :app module,
matching Holio's layout.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015qjfMiPUDshdKEUa6vxqzN
This commit is contained in:
Claude
2026-08-05 21:54:13 +00:00
parent a5258c8ee6
commit 4312616efa
2 changed files with 136 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
name: CI
# Pre-merge checks. Runs on the dev branch and on every pull request aimed at
# dev or main, so breakage is caught before it reaches main and triggers a
# release. Builds the same debug APK as the release pipeline, but publishes it
# only as a workflow artifact — no tag, no GitHub Release.
on:
push:
branches: [ dev ]
pull_request:
branches: [ main, dev ]
workflow_dispatch:
permissions:
contents: read
# A newer push to the same branch or PR makes the in-flight run obsolete.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: gradle
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Build debug APK
run: ./gradlew assembleDebug --no-daemon --stacktrace
- name: Run unit tests
run: ./gradlew testDebugUnitTest --no-daemon --stacktrace
- name: Run Android lint
run: ./gradlew lintDebug --no-daemon --stacktrace
- name: Upload debug APK
uses: actions/upload-artifact@v4
with:
name: ProLibertateGames-debug-apk
path: app/build/outputs/apk/debug/app-debug.apk
if-no-files-found: error
retention-days: 14
- name: Upload lint and test reports
# Reports are most useful precisely when a step above failed.
if: always()
uses: actions/upload-artifact@v4
with:
name: ProLibertateGames-reports
path: |
app/build/reports/
if-no-files-found: ignore
retention-days: 14
+70
View File
@@ -0,0 +1,70 @@
name: Build and Release APK
# Build an APK and publish it as a GitHub Release whenever commits land on main
# (for example when a pull request is merged). Can also be run manually.
on:
push:
branches: [ main ]
workflow_dispatch:
# Allow the built-in token to create releases and upload the APK.
permissions:
contents: write
# Don't let two pushes to main race on the same release.
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build APK and publish release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: gradle
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Build debug APK
run: ./gradlew assembleDebug --no-daemon --stacktrace
- name: Stage APK for release
id: stage
run: |
set -euo pipefail
version="v1.0.${{ github.run_number }}"
src="app/build/outputs/apk/debug/app-debug.apk"
dest="ProLibertateGames-${version}.apk"
cp "$src" "$dest"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "apk=$dest" >> "$GITHUB_OUTPUT"
- name: Upload APK as workflow artifact
uses: actions/upload-artifact@v4
with:
name: ProLibertateGames-apk
path: ${{ steps.stage.outputs.apk }}
if-no-files-found: error
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh release create "${{ steps.stage.outputs.version }}" \
"${{ steps.stage.outputs.apk }}" \
--repo "${{ github.repository }}" \
--target "${{ github.sha }}" \
--title "ProLibertateGames ${{ steps.stage.outputs.version }}" \
--notes "Automated release built from \`${{ github.sha }}\` on push to \`main\`.
Download **${{ steps.stage.outputs.apk }}** below and install it on an Android device (you may need to allow *Install unknown apps*). This is a debug-signed build."