diff --git a/.github/workflows/play-release.yml b/.github/workflows/play-release.yml index 6981e57b2..6553495c5 100644 --- a/.github/workflows/play-release.yml +++ b/.github/workflows/play-release.yml @@ -1,16 +1,16 @@ name: "Play: 2. publish release" # K2GO-564, button 2 of the release flow. Design: controller/docs/ADR-K2GO-564-play-release-candidates.md -# Run this after Google approved a candidate. It tags the candidate commit with the final version -# (v1.2.0-rc.2 -> v1.2.0) and runs the release build: GitHub Release, website APKs, R2 and the OTA -# update.json. An rc build is never released as final: the tagged commit must have versionName -# "v1.2.0" (check-release), so an rc commit is refused until the final-build step exists (K2GO-564). +# Run this from main after Google approved a candidate and main says versionName "vX.Y.Z" (the final +# commit: same code, only the version line changed). It tags that commit with the final version and +# runs the release build: GitHub Release, website APKs, R2 and the OTA update.json. An rc build is +# never released as final (check-release). on: workflow_dispatch: inputs: rc_tag: - description: "Approved candidate tag, for example v1.2.0-rc.2" + description: "Approved candidate tag, for example v1.2.0-rc.3 (the final commit is main)" required: true concurrency: @@ -39,15 +39,16 @@ jobs: # Refuses a malformed tag, a released version, and a candidate older than the newest. git ls-remote --tags origin 'v*' | sed 's#.*refs/tags/##; s#\^{}$##' | sort -u > "$RUNNER_TEMP/tags.txt" final=$(python3 tools/play-publish/play_publish.py final-tag --rc-tag "$RC_TAG" --tags "$RUNNER_TEMP/tags.txt") - git fetch --no-tags origin "refs/tags/$RC_TAG:refs/tags/$RC_TAG" - # An rc build is never released as final: the tagged commit must say versionName "$final". - git show "$RC_TAG:controller/app/build.gradle" > "$RUNNER_TEMP/build.gradle" - python3 tools/play-publish/play_publish.py check-release --gradle "$RUNNER_TEMP/build.gradle" --tag "$final" - git tag "$final" "$RC_TAG^{commit}" + # The final commit is main: an rc build is never released as final, so it must say versionName "$final". + if [ "$GITHUB_REF" != "refs/heads/main" ]; then + echo "::error::Run this from main, not $GITHUB_REF."; exit 1 + fi + python3 tools/play-publish/play_publish.py check-release --gradle controller/app/build.gradle --tag "$final" + git tag "$final" "$GITHUB_SHA" git push origin "refs/tags/$final" echo "tag=$final" >> "$GITHUB_OUTPUT" { - echo "## $final tagged on $(git rev-parse "$RC_TAG^{commit}") (from $RC_TAG)" + echo "## $final tagged on $GITHUB_SHA (approved candidate: $RC_TAG)" echo "- Now press **Publish changes** in Play Console to release the approved AAB." } >> "$GITHUB_STEP_SUMMARY" diff --git a/controller/app/build.gradle b/controller/app/build.gradle index 7cc971579..5c68a6c12 100644 --- a/controller/app/build.gradle +++ b/controller/app/build.gradle @@ -45,13 +45,13 @@ android { // 3. Version Control (OTA) // NOTE: the APK carries this number x 10 (71 -> 710); see "VERSION CODE AND APK NAME" below // K2GO-564: versionCode comes from versionName, 2 digits per field (play_publish.py version_code_base_for). - versionCode 1020003 + versionCode 1020099 // Dynamic version suffix: CI passes -PversionSuffix explicitly; local builds fall back to // the git short SHA (ADFA-4787) so any installed APK is traceable to its commit. def ciSuffix = project.hasProperty('versionSuffix') ? project.property('versionSuffix') : (project.ext.gitSha ? "-${project.ext.gitSha}" : "") // A release candidate carries its rc label (v1.2.0-rc.1); only the final release drops it. - versionName "v1.2.0-rc.3${ciSuffix}" + versionName "v1.2.0${ciSuffix}" buildConfigField "String", "GIT_SHA", "\"${project.ext.gitSha}\"" // Analytics is a per-flavor property (see productFlavors): the "standard" flavor turns it on // when google-services.json is present; "fdroid" forces it off. The safe default here is OFF. diff --git a/controller/docs/ADR-K2GO-564-play-release-candidates.md b/controller/docs/ADR-K2GO-564-play-release-candidates.md index 85e5e3065..58bd271be 100644 --- a/controller/docs/ADR-K2GO-564-play-release-candidates.md +++ b/controller/docs/ADR-K2GO-564-play-release-candidates.md @@ -48,9 +48,9 @@ says `vX.Y.Z-rc.N`, and only a build that says `vX.Y.Z` can become the release. 4. Button 2, `play-release.yml`: accept only the newest rc of the version (each new candidate replaces the older one in Play) and run the release build (GitHub Release, website APKs, R2, OTA `update.json`). An rc build is never released as final: both the tag step and the - release build refuse a commit whose `versionName` is not exactly `vX.Y.Z`. The final build - (versionName `vX.Y.Z`, sent to Play, then tagged) is not designed yet, so today button 2 - refuses every rc commit. The release build runs only when `play-release.yml` calls it: + release build refuse a commit whose `versionName` is not exactly `vX.Y.Z`. The final commit + is `main` after a PR that only sets `versionName "vX.Y.Z"` and its versionCode; button 2 runs + from `main` and tags that commit. The release build runs only when `play-release.yml` calls it: a hand-pushed `v*` tag does not start a release. 5. Play credentials, keyless: the service account `k2go-play-publisher@knowledge-to-go.iam.gserviceaccount.com` (Google Cloud project