Build and Release APK / Build APK and publish release (push) Canceled after 0s
Import of ProLibertateGames (upstream main, GPL-3.0) rebranded for Wallacenet and repointed at git.wallacenet.ca. - Identity: applicationId ca.wallacenet.pilgrimsofkatan (+ .dev for the dev channel), launcher names "Pilgrims of Katan" / "Pilgrims of Katan DEV", neutral hexagon branding replacing the Wallace tartan. Uncial Antiqua keeps its OFL licence, and the GPL-3.0 LICENSE plus upstream attribution stay. - OTA: Updater.kt now reads this repo's own Gitea releases (/api/v1/repos/devadmin/PilgrimsOfKatan/releases...) and BuildConfig. OTA_ENABLED is on; Gitea answers the same JSON shape the code already parsed. - Build numbers: versionCode = CI run number + plgVersionRunOffset (1000), with the tag and versionName derived from the same figure. The offset is permanent, because Gitea Actions restarts run numbers at 1 and a reset would otherwise make Android reject the next build as a downgrade. - CI: ci.yml publishes a dev prerelease from dev, release.yml a production release from main, both through scripts/publish-release.sh (Gitea REST API, runnable by hand until an Actions runner is registered). - Docs: docs/CI.md records the channel, numbering and runner decisions; docs/README.md seeds the per-game RULES-* conventions; CLAUDE.md carries the agent ground rules. Verified: ./gradlew assembleDebug and testDebugUnitTest green on JDK 17 / compileSdk 34, both variants stamped, installing side by side under the new identity. Co-Authored-By: Paperclip <[email protected]>
89 lines
3.1 KiB
YAML
89 lines
3.1 KiB
YAML
name: Build and Release APK
|
|
|
|
# Production-channel build. Runs on a push to main, or by hand
|
|
# (workflow_dispatch), and publishes to this Gitea instance's releases — which
|
|
# is the channel the in-app updater reads. See docs/CI.md.
|
|
#
|
|
# Publishing goes through Gitea's REST API rather than the `gh` CLI, which a
|
|
# runner image need not carry.
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
# Needed by the job token to create the release and attach 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
|
|
# workflow_dispatch can be aimed at any branch from the Actions UI. The
|
|
# production stamp belongs to main alone — anything else is a no-op rather
|
|
# than shipping unreviewed code to everybody.
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# Stamps the APK as a production-channel build.
|
|
PLG_CHANNEL: production
|
|
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@v4
|
|
|
|
- name: Build production APK
|
|
run: ./gradlew assembleDebug --no-daemon --stacktrace
|
|
|
|
- name: Stage APK
|
|
id: stage
|
|
run: |
|
|
set -euo pipefail
|
|
# The series and the offset come from gradle.properties, which is
|
|
# the same file the build read when it stamped the APK — so the tag
|
|
# and what is inside it cannot name different versions. The number
|
|
# is run number + offset, exactly the arithmetic build.gradle.kts
|
|
# did for versionCode.
|
|
series="$(sed -n 's/^plgVersionSeries=//p' gradle.properties)"
|
|
offset="$(sed -n 's/^plgVersionRunOffset=//p' gradle.properties)"
|
|
test -n "$series"
|
|
test -n "$offset"
|
|
stamp="$(( ${{ github.run_number }} + offset ))"
|
|
version="v${series}.${stamp}"
|
|
src="app/build/outputs/apk/debug/app-debug.apk"
|
|
dest="PilgrimsOfKatan-${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: PilgrimsOfKatan-apk
|
|
path: ${{ steps.stage.outputs.apk }}
|
|
if-no-files-found: error
|
|
|
|
- name: Publish production release
|
|
env:
|
|
# The job's built-in token: contents: write is declared above.
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
RELEASE_TAG: ${{ steps.stage.outputs.version }}
|
|
RELEASE_APK: ${{ steps.stage.outputs.apk }}
|
|
RELEASE_KIND: release
|
|
RELEASE_TARGET: ${{ github.sha }}
|
|
# One script, also runnable by hand — see docs/CI.md.
|
|
run: ./scripts/publish-release.sh
|