Bootstrap Pilgrims of Katan: rebrand, Gitea CI and OTA
Build and Release APK / Build APK and publish release (push) Canceled after 0s
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]>
This commit is contained in:
co-authored by
Paperclip
parent
d27c2db894
commit
fad4778ad8
+37
-37
@@ -1,15 +1,19 @@
|
||||
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.
|
||||
# dev or main, so breakage is caught before it reaches main.
|
||||
#
|
||||
# On a push to dev it also publishes the build as a dev-channel prerelease, so
|
||||
# the in-app updater can offer it to anyone who has switched to that channel.
|
||||
# Prereleases are used deliberately: GitHub's "latest release" endpoint skips
|
||||
# them, so a production-channel user never sees a dev build. Pull requests only
|
||||
# build and check — they never publish, which keeps a PR from a fork from
|
||||
# shipping anything.
|
||||
# On a push to dev it also publishes the build as a dev-channel prerelease on
|
||||
# this Gitea instance, so the in-app updater can offer it to anyone on the dev
|
||||
# channel. Prereleases are used deliberately: the "latest release" endpoint
|
||||
# skips them, so a production-channel user never sees a dev build. Pull
|
||||
# requests only build and check — they never publish, which keeps a PR from a
|
||||
# fork from shipping anything.
|
||||
#
|
||||
# These files live in .github/workflows/ on purpose: Gitea Actions reads that
|
||||
# path as well as .gitea/workflows/, so one file serves both. Publishing goes
|
||||
# through Gitea's REST API (the same routes the app's updater reads) rather
|
||||
# than the `gh` CLI, which a runner image need not carry.
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
@@ -17,7 +21,7 @@ on:
|
||||
branches: [ main, dev ]
|
||||
workflow_dispatch:
|
||||
|
||||
# Needed to publish the dev-channel prerelease below.
|
||||
# Needed by the job token to create the release and attach the APK.
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
@@ -37,10 +41,7 @@ jobs:
|
||||
# <series>.0-dev: they are never published and must not claim a channel
|
||||
# version.
|
||||
#
|
||||
# This condition has to stay in step with the publish steps' own. Stamping
|
||||
# a build the publish steps would ship, or shipping one this left
|
||||
# unstamped, both end the same way — an APK claiming versionCode 1, which
|
||||
# the updater can never see as an upgrade over anything.
|
||||
# This condition has to stay in step with the publish steps' own.
|
||||
PLG_CHANNEL: ${{ github.ref == 'refs/heads/dev' && 'dev' || '' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -68,7 +69,7 @@ jobs:
|
||||
- name: Upload debug APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ProLibertateGames-debug-apk
|
||||
name: PilgrimsOfKatan-debug-apk
|
||||
path: app/build/outputs/apk/debug/app-debug.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
@@ -78,7 +79,7 @@ jobs:
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ProLibertateGames-reports
|
||||
name: PilgrimsOfKatan-reports
|
||||
path: |
|
||||
app/build/reports/
|
||||
if-no-files-found: ignore
|
||||
@@ -88,22 +89,27 @@ jobs:
|
||||
# branch itself, after it has built, tested and linted clean above.
|
||||
#
|
||||
# Gated on the branch alone rather than on the event, which is how
|
||||
# release.yml has always gated main. A pull request is still excluded
|
||||
# without needing to name it: a PR build runs against refs/pull/N/merge,
|
||||
# never refs/heads/dev, so a fork still cannot ship anything.
|
||||
# release.yml gates main. A pull request is still excluded without
|
||||
# needing to name it: a PR build runs against refs/pull/N/merge, never
|
||||
# refs/heads/dev, so a fork still cannot ship anything.
|
||||
- name: Stage dev APK
|
||||
id: stage
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# The series comes 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 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"
|
||||
version="v${series}.${{ github.run_number }}-dev"
|
||||
test -n "$offset"
|
||||
stamp="$(( ${{ github.run_number }} + offset ))"
|
||||
version="v${series}.${stamp}-dev"
|
||||
src="app/build/outputs/apk/debug/app-debug.apk"
|
||||
dest="ProLibertateGames-${version}.apk"
|
||||
dest="PilgrimsOfKatan-${version}.apk"
|
||||
cp "$src" "$dest"
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
echo "apk=$dest" >> "$GITHUB_OUTPUT"
|
||||
@@ -111,17 +117,11 @@ jobs:
|
||||
- name: Publish dev channel prerelease
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
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 }}" \
|
||||
--prerelease \
|
||||
--notes "Automated **dev channel** build from \`${{ github.sha }}\` on \`dev\`.
|
||||
|
||||
Preview build: newer than production, and less tested. Switch to the
|
||||
Dev update channel in Settings to be offered these. Marked as a
|
||||
prerelease so production-channel installs never see it."
|
||||
# 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: prerelease
|
||||
RELEASE_TARGET: ${{ github.sha }}
|
||||
# One script, also runnable by hand — see docs/CI.md.
|
||||
run: ./scripts/publish-release.sh
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
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.
|
||||
# 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:
|
||||
|
||||
# Allow the built-in token to create releases and upload the APK.
|
||||
# Needed by the job token to create the release and attach the APK.
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
@@ -19,14 +23,13 @@ concurrency:
|
||||
jobs:
|
||||
build:
|
||||
name: Build APK and publish release
|
||||
# workflow_dispatch can be aimed at any branch from the Actions UI. Releases
|
||||
# are what the in-app updater installs, so only main may produce one —
|
||||
# anything else is a no-op rather than shipping unreviewed code to everyone.
|
||||
# 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, versioned with the run
|
||||
# number that matches the tag published below.
|
||||
# Stamps the APK as a production-channel build.
|
||||
PLG_CHANNEL: production
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -42,52 +45,44 @@ jobs:
|
||||
- name: Set up Android SDK
|
||||
uses: android-actions/setup-android@v4
|
||||
|
||||
- name: Build debug APK
|
||||
- name: Build production APK
|
||||
run: ./gradlew assembleDebug --no-daemon --stacktrace
|
||||
|
||||
- name: Stage APK for release
|
||||
- name: Stage APK
|
||||
id: stage
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# The series comes 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 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"
|
||||
version="v${series}.${{ github.run_number }}"
|
||||
test -n "$offset"
|
||||
stamp="$(( ${{ github.run_number }} + offset ))"
|
||||
version="v${series}.${stamp}"
|
||||
src="app/build/outputs/apk/debug/app-debug.apk"
|
||||
dest="ProLibertateGames-${version}.apk"
|
||||
dest="PilgrimsOfKatan-${version}.apk"
|
||||
cp "$src" "$dest"
|
||||
# The same build again under a name that never changes. GitHub's
|
||||
# /releases/latest/download/<name> redirect needs a constant file
|
||||
# name, so this second copy is what makes a permanent download link
|
||||
# possible — the versioned copy stays as the traceable one.
|
||||
cp "$src" "ProLibertateGames.apk"
|
||||
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
|
||||
name: PilgrimsOfKatan-apk
|
||||
path: ${{ steps.stage.outputs.apk }}
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Create GitHub release
|
||||
- name: Publish production release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh release create "${{ steps.stage.outputs.version }}" \
|
||||
"${{ steps.stage.outputs.apk }}" \
|
||||
"ProLibertateGames.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.
|
||||
|
||||
Both files below are the same build. \`ProLibertateGames.apk\` is a copy under a fixed name, so this link always fetches the newest release and can be bookmarked or shared:
|
||||
|
||||
https://github.com/${{ github.repository }}/releases/latest/download/ProLibertateGames.apk"
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user