ci: a merge to main is the public release; every dev push dry-runs it (#8358)
release / web (push) Successful in 1m29s
release / go (push) Successful in 1m54s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 2m44s
release / android (push) Successful in 2m9s
release / Build signed APK (push) Successful in 2m1s
release / Build + push container image (push) Failing after 4s
release / web (push) Successful in 1m29s
release / go (push) Successful in 1m54s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 2m44s
release / android (push) Successful in 2m9s
release / Build signed APK (push) Successful in 2m1s
release / Build + push container image (push) Failing after 4s
Every push now builds its image from the git archive export, after the changelog and the leak gate have run on it, so a dev push is the public release's dry run. A push to main then also commits and tags the export on github.com/Fabled-Sword/minstrel as AmateurDungeoneer, publishes ghcr.io/fabled-sword/minstrel :<name> and :latest, and creates the release page on GitHub (public changelog) and on this forge (private changelog). The scripts are Librarian's (ci/changelog.sh, ci/leakgate.sh, ci/releases.mjs, with their tests), with Minstrel's false positives and a changelog that ignores the forge-only v* tags from before the public releases, so the first public release is the fixed note. The tag build, its APK attach and its verify job, and the manual GHCR dispatch are gone: phones get the app from the server image, and no release carries a file. The push trigger has no path filter, because the README, docs and tests ship in the public release too. The README's image tags now name what GHCR carries: :latest and :<version>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+233
-458
@@ -1,17 +1,20 @@
|
||||
name: release
|
||||
|
||||
# Builds and pushes the minstrel container image to the Gitea registry.
|
||||
# Builds and pushes the minstrel container image to the Gitea registry, and on
|
||||
# main also makes the public release.
|
||||
#
|
||||
# push to dev → :dev (freshly-built dev APK bundled)
|
||||
# push to main → :latest + :<sha> (freshly-built stable APK bundled)
|
||||
# push tag vYYYY.MM.DD.HHMM → :latest (fresh APK bundled, and attached to the Release)
|
||||
# workflow_dispatch → manual trigger (same rules based on the ref)
|
||||
# workflow_dispatch, ghcr_release → ghcr.io/fabled-sword/minstrel:<version> + :latest,
|
||||
# built from the public export (ghcr-release),
|
||||
# and nothing on the private registry
|
||||
# push to dev → :dev (freshly-built dev APK bundled), and the
|
||||
# public release's dry run
|
||||
# push to main → :latest + :<sha> (freshly-built stable APK bundled), then
|
||||
# THE PUBLIC RELEASE: one commit and tag v<name> on
|
||||
# github.com/Fabled-Sword/minstrel, the image
|
||||
# ghcr.io/fabled-sword/minstrel :<name> + :latest, and a
|
||||
# release page with its changelog on both forges
|
||||
# workflow_dispatch → the same as a push to the dispatched branch, private
|
||||
# half only; force_red checks the gate (see below)
|
||||
#
|
||||
# That is the whole tag map. The rest of this header is about the private
|
||||
# registry; the public release image is described at ghcr-release.
|
||||
# registry; the public release is described at image-release.
|
||||
#
|
||||
# :<sha> on main is the ROLLBACK UNIT — every production commit addressable
|
||||
# without a release ceremony. It is minted only on main, where rollback is
|
||||
@@ -47,33 +50,24 @@ name: release
|
||||
#
|
||||
# Every branch build carries the app built from its own commit, so a merge to
|
||||
# main is all it takes to put a new app in front of stable phones: `:latest`
|
||||
# serves it from /api/client/apk and the in-app update offers it. A release
|
||||
# is an optional bookmark — a named point in history with the APK attached
|
||||
# for download — never a step the app has to wait for.
|
||||
# serves it from /api/client/apk and the in-app update offers it. The app is
|
||||
# never published on its own; it reaches phones only through the server.
|
||||
#
|
||||
# Release model: the tag IS the artifact's version name with a `v` in front.
|
||||
# `v2026.09.10.1432` and `2026.09.10.1432` are the same string, derived from
|
||||
# the tagged commit's UTC timestamp — so there is no mismatch to reconcile
|
||||
# between what the tag says and what the APK reports, and nothing to look up
|
||||
# when minting one.
|
||||
# Release model: a merge to main IS the release. Its name is v<YYYY.MM.DD.HHMM>
|
||||
# from the merge commit's UTC time, so every merge has its own. The run makes
|
||||
# the tag on both forges; nobody tags by hand.
|
||||
#
|
||||
# TAGS ARE IMMUTABLE. Never move, retarget or delete a published tag. A
|
||||
# same-day second release is not a collision — HHMM makes every tag unique
|
||||
# by construction, so the answer is simply another tag. Anyone installing
|
||||
# from a moved tag would hold something the tag no longer points at, which
|
||||
# is a worse failure than an extra row in the tag list.
|
||||
# TAGS ARE IMMUTABLE. Never move, retarget or delete a published tag. A re-run
|
||||
# finds its tag already published: on the same tree it goes on, on another it
|
||||
# stops. A failed public half is fixed on dev, and the next merge carries a new
|
||||
# name.
|
||||
#
|
||||
# :latest is updated by every main push AND every tag push, so it always
|
||||
# reflects the newest blessed image.
|
||||
#
|
||||
# APK pipeline: on every push — dev, main and tags alike — the
|
||||
# android-release job builds + signs the Android APK and uploads it as a
|
||||
# workflow artifact. The image-release job declares `needs: android-release`
|
||||
# and requires its success, so the docker image cannot start building until
|
||||
# the APK is guaranteed-ready — no polling, no race, no silent-failure mode,
|
||||
# and no image that moves a channel without an app inside it. Attaching the
|
||||
# APK to the gitea Release is its own job (release-assets), tags only, behind
|
||||
# the test gate below.
|
||||
# APK pipeline: on every push the android-release job builds + signs the
|
||||
# Android APK and uploads it as a workflow artifact. The image-release job
|
||||
# declares `needs: android-release` and requires its success, so the docker
|
||||
# image cannot start building until the APK is guaranteed-ready — no polling,
|
||||
# no race, no silent-failure mode, and no image that moves a channel without
|
||||
# an app inside it.
|
||||
#
|
||||
# THE GATE. Every verifying lane lives in this file —
|
||||
# Go (vet, lint, short tests), the Postgres integration suite, the web app
|
||||
@@ -92,42 +86,30 @@ name: release
|
||||
# path filters for the same reason: a web-only push still runs the Go suite,
|
||||
# because "not run" must never read as "passed".
|
||||
#
|
||||
# What publishes, and is therefore gated: the image tags (image-release) and
|
||||
# the APK + version sidecar attached to a tag's Release (release-assets).
|
||||
# android-release only BUILDS the signed APK into a workflow artifact, which
|
||||
# nobody outside this run can pull, so it runs in parallel with the lanes
|
||||
# instead of after them; attaching it to the Release is the publishing half,
|
||||
# and that half waits for the gate.
|
||||
# What publishes, and is therefore gated: everything image-release pushes, the
|
||||
# private image tags and the whole public release. android-release only BUILDS
|
||||
# the signed APK into a workflow artifact, which nobody outside this run can
|
||||
# pull, so it runs in parallel with the lanes instead of after them.
|
||||
#
|
||||
# To watch the gate refuse: dispatch this workflow with force_red=true. The go
|
||||
# lane fails on purpose, and both publishing jobs must report skipped.
|
||||
# lane fails on purpose, and the publishing job must report skipped.
|
||||
|
||||
# No path filter. The README, docs and tests ship in the public release too,
|
||||
# so a merge to main that changes only them must still run, or it would not
|
||||
# release.
|
||||
on:
|
||||
push:
|
||||
branches: [main, dev]
|
||||
tags: ['v*']
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**/*.md'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force_red:
|
||||
description: Fail the go lane on purpose, to check that nothing publishes on red
|
||||
type: boolean
|
||||
default: false
|
||||
ghcr_release:
|
||||
description: Build the public release image from the exported tree for GHCR (ghcr-release), instead of the private channel image
|
||||
type: boolean
|
||||
default: false
|
||||
ghcr_dry_run:
|
||||
description: With ghcr_release, build and check but push nothing. Untick only for the real release, run on main
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
# A rapid re-push to main supersedes the in-flight build: the later commit
|
||||
# wins. Tags are immutable and unique, so no tag build can be superseded by
|
||||
# another run on the same ref. The event name is in the group so a dispatch
|
||||
# and a push on the same ref never cancel each other.
|
||||
# wins. The event name is in the group so a dispatch and a push on the same
|
||||
# ref never cancel each other.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
@@ -454,12 +436,10 @@ jobs:
|
||||
|
||||
android-release:
|
||||
name: Build signed APK
|
||||
# Builds on every ref, so each channel's image carries the app from its
|
||||
# own commit: `dev` for the test channel, `main` for stable phones, and a
|
||||
# tag for the copy attached to its Release.
|
||||
# Builds on both branches, so each channel's image carries the app from
|
||||
# its own commit: `dev` for the test channel, `main` for stable phones.
|
||||
if: >-
|
||||
startsWith(github.ref, 'refs/tags/v')
|
||||
|| github.ref == 'refs/heads/dev'
|
||||
github.ref == 'refs/heads/dev'
|
||||
|| github.ref == 'refs/heads/main'
|
||||
runs-on: flutter-ci
|
||||
container:
|
||||
@@ -523,32 +503,6 @@ jobs:
|
||||
echo "channel=${channel}" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::APK $(printf '%s' "${out}" | tr '\n' ' ') channel=${channel}"
|
||||
|
||||
# Checked BEFORE the expensive work, not after it. "Attach APK to gitea
|
||||
# Release" below resolves the release by tag and fails if it is absent —
|
||||
# but that is the final step, so a tag pushed without a release would
|
||||
# build an APK for several minutes first and only then find it has
|
||||
# nowhere to put it. Same check, seconds in instead of minutes.
|
||||
#
|
||||
# Releases are normally created through the API (which creates the tag and
|
||||
# the release together, so this passes). A bare `git push origin vX` is the
|
||||
# case this catches.
|
||||
- name: Release must exist for this tag
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
shell: bash
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
if ! curl -fsSL -o /dev/null \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
"https://git.fabledsword.com/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}"; then
|
||||
echo "::error::no release exists for ${TAG}. Create the release (which creates the tag) rather than pushing a bare tag — otherwise there is nothing to attach the APK to."
|
||||
exit 1
|
||||
fi
|
||||
echo "::notice::release found for ${TAG}"
|
||||
|
||||
- name: Cache Gradle dirs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
@@ -629,98 +583,21 @@ jobs:
|
||||
# artifact existing, so an empty upload must fail here, not there.
|
||||
if-no-files-found: error
|
||||
|
||||
# Publishes the signed APK and its version sidecar on the tag's Release.
|
||||
# Split out of android-release so the APK can be BUILT in parallel with the
|
||||
# lanes while being PUBLISHED only once they have all passed.
|
||||
release-assets:
|
||||
name: Attach APK to the Release (tag releases only)
|
||||
needs: [go, integration, web, android, govulncheck, android-release]
|
||||
if: >-
|
||||
${{
|
||||
!cancelled()
|
||||
&& needs.go.result == 'success'
|
||||
&& needs.integration.result == 'success'
|
||||
&& needs.web.result == 'success'
|
||||
&& needs.android.result == 'success'
|
||||
&& needs.govulncheck.result == 'success'
|
||||
&& needs.android-release.result == 'success'
|
||||
&& startsWith(github.ref, 'refs/tags/v') }}
|
||||
runs-on: go-ci
|
||||
container:
|
||||
image: git.fabledsword.com/bvandeusen/ci-go:1.26
|
||||
|
||||
steps:
|
||||
- name: Download signed APK artifact
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: minstrel-apk
|
||||
path: release-apk/
|
||||
|
||||
- name: Attach APK to gitea Release
|
||||
# Tag releases only. A branch build has no Release to hang assets on
|
||||
# and does not need one — its image bundles the APK, and the server
|
||||
# serves it from /api/client/apk.
|
||||
shell: bash
|
||||
env:
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
VERSION_NAME: ${{ needs.android-release.outputs.version_name }}
|
||||
VERSION_CODE: ${{ needs.android-release.outputs.version_code }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
REPO="${GITHUB_REPOSITORY}"
|
||||
APK_PATH="release-apk/app-release.apk"
|
||||
ls -lh "${APK_PATH}"
|
||||
|
||||
# Publish the version sidecar as a release asset next to the APK.
|
||||
#
|
||||
# This is what lets a later :latest build stop RECONSTRUCTING the
|
||||
# bundled APK's version and simply read what was recorded. The
|
||||
# ordering key in particular cannot be re-derived after the fact —
|
||||
# it is build-time minutes, so once this job ends the value exists
|
||||
# nowhere else. Reconstruction could only ever recover the name,
|
||||
# and only by duplicating a formula that then has to be kept in
|
||||
# step across two files.
|
||||
SIDECAR_PATH="/tmp/minstrel.apk.version"
|
||||
printf '{"name":"%s","code":%s,"channel":"stable"}\n' \
|
||||
"${VERSION_NAME}" "${VERSION_CODE}" > "${SIDECAR_PATH}"
|
||||
cat "${SIDECAR_PATH}"
|
||||
|
||||
RELEASE_JSON="$(curl -fsSL \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/tags/${TAG}")"
|
||||
RELEASE_ID="$(printf '%s' "${RELEASE_JSON}" | grep -oP '"id":\s*\K[0-9]+' | head -1)"
|
||||
if [ -z "${RELEASE_ID}" ]; then
|
||||
echo "::error::release for ${TAG} not found"; exit 1
|
||||
fi
|
||||
echo "release_id=${RELEASE_ID}"
|
||||
|
||||
UPLOAD_HTTP=$(curl -sS -L -o /tmp/upload.out -w '%{http_code}' \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
-F "attachment=@${APK_PATH}" \
|
||||
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=minstrel-${TAG}.apk")
|
||||
echo "upload_http=${UPLOAD_HTTP}"
|
||||
cat /tmp/upload.out || true
|
||||
echo
|
||||
if [ "${UPLOAD_HTTP}" -lt 200 ] || [ "${UPLOAD_HTTP}" -ge 300 ]; then
|
||||
echo "::error::APK upload returned HTTP ${UPLOAD_HTTP}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Same treatment for the sidecar. Named `.apk.version` so the
|
||||
# downloader's `\.apk$` match cannot pick it up by mistake.
|
||||
SIDECAR_HTTP=$(curl -sS -L -o /tmp/upload-sidecar.out -w '%{http_code}' \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
-F "attachment=@${SIDECAR_PATH}" \
|
||||
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=minstrel-${TAG}.apk.version")
|
||||
echo "sidecar_upload_http=${SIDECAR_HTTP}"
|
||||
cat /tmp/upload-sidecar.out || true
|
||||
echo
|
||||
if [ "${SIDECAR_HTTP}" -lt 200 ] || [ "${SIDECAR_HTTP}" -ge 300 ]; then
|
||||
echo "::error::version sidecar upload returned HTTP ${SIDECAR_HTTP}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The image, and on main the public release.
|
||||
#
|
||||
# Every push builds its image FROM THE EXPORT, `git archive` of this commit,
|
||||
# and runs the changelog and the leak gate on it first. So a dev push is the
|
||||
# public release's dry run: an export that leaks or does not build is red the
|
||||
# day it lands, not at the merge.
|
||||
#
|
||||
# A push to main is also the PUBLIC release, after the private push:
|
||||
# 1. the export becomes one commit on github.com/Fabled-Sword/minstrel's
|
||||
# main, tagged v<name>, authored by AmateurDungeoneer and dated in UTC;
|
||||
# 2. that tree is built into ghcr.io/fabled-sword/minstrel :<name> and
|
||||
# :latest, labelled with the public repository and commit;
|
||||
# 3. a GitHub Release with the public changelog, and a release on this forge
|
||||
# with the private one, both v<name>, both naming the image.
|
||||
# <name> is YYYY.MM.DD.HHMM from the merge commit's time.
|
||||
image-release:
|
||||
name: Build + push container image
|
||||
# Every lane must have SUCCEEDED, each named here, and so must the APK
|
||||
@@ -735,42 +612,29 @@ jobs:
|
||||
&& needs.web.result == 'success'
|
||||
&& needs.android.result == 'success'
|
||||
&& needs.govulncheck.result == 'success'
|
||||
&& needs.android-release.result == 'success'
|
||||
&& github.event.inputs.ghcr_release != 'true' }}
|
||||
&& needs.android-release.result == 'success' }}
|
||||
runs-on: go-ci
|
||||
container:
|
||||
image: git.fabledsword.com/bvandeusen/ci-go:1.26
|
||||
|
||||
env:
|
||||
IMAGE: git.fabledsword.com/bvandeusen/minstrel
|
||||
PUBLIC_REPO: Fabled-Sword/minstrel
|
||||
PUBLIC_IMAGE: ghcr.io/fabled-sword/minstrel
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Full history: any job that DERIVES the version name needs it,
|
||||
# because a shallow clone changes what git-derived values resolve to
|
||||
# WITHOUT failing — a too-low value, silently, with every lane green.
|
||||
#
|
||||
# This job runs ci/version.sh itself: with no :<version> image tags,
|
||||
# the server's self-reported version is the only thing that says which
|
||||
# build an image is.
|
||||
# Full history and its tags: any job that DERIVES the version name
|
||||
# needs it, because a shallow clone changes what git-derived values
|
||||
# resolve to WITHOUT failing — a too-low value, silently, with every
|
||||
# lane green. The changelog lists the commits since the previous
|
||||
# release's tag, so it needs them too.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Detect buildable project
|
||||
id: guard
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -f Dockerfile ] && [ -f go.mod ]; then
|
||||
echo "ready=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "ready=false" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::No Dockerfile + go.mod yet — release build skipped"
|
||||
fi
|
||||
|
||||
- name: Compute image tags
|
||||
id: tags
|
||||
if: steps.guard.outputs.ready == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -778,10 +642,10 @@ jobs:
|
||||
# THE VERSION, and it is derived the same way on every ref — the
|
||||
# branch decides the CHANNEL, never the version.
|
||||
#
|
||||
# A per-ref string ("main", "dev", the tag name) would not order, and
|
||||
# "dev" would be the same string forever — two dev images eight weeks
|
||||
# apart indistinguishable in the UI. With no version image tags, this
|
||||
# is how an admin tells which build a container is running.
|
||||
# A per-ref string ("main", "dev") would not order, and "dev" would be
|
||||
# the same string forever — two dev images eight weeks apart
|
||||
# indistinguishable in the UI. The server's self-reported version is
|
||||
# how an admin tells which build a private image is.
|
||||
#
|
||||
# `sed -n s///p` rather than `grep`: it exits 0 when nothing matches,
|
||||
# so the empty check below is actually reachable. A grep here would
|
||||
@@ -792,24 +656,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
|
||||
# A release refreshes the CHANNEL and mints nothing else.
|
||||
#
|
||||
# The tag build exists to produce the signed APK and attach it to
|
||||
# the release; the image it rebuilds is the SAME SOURCE as the main
|
||||
# build minutes earlier, differing only in which APK is baked in.
|
||||
# When the same source is rebuilt with different contents,
|
||||
# publish the moving channel tag and never a commit-addressable
|
||||
# one.
|
||||
#
|
||||
# :latest moves here so the server hands out the same APK build
|
||||
# that is attached to the Release: a phone that installed from the
|
||||
# Release page and one that updated in-app hold one build, with one
|
||||
# ordering key. Cut a release on main's tip, as :latest follows it.
|
||||
CHANNEL=stable
|
||||
echo "args=-t ${IMAGE}:latest" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::Release build ${VERSION}: refreshing :latest around the new APK"
|
||||
elif [[ "${GITHUB_REF}" == "refs/heads/dev" ]]; then
|
||||
if [[ "${GITHUB_REF}" == "refs/heads/dev" ]]; then
|
||||
# The rolling test channel, and :dev ALONE — deliberately no
|
||||
# per-commit tag. A rolling channel is rolling by definition, so a
|
||||
# commit-addressable image here would be a rollback target nobody
|
||||
@@ -830,8 +677,72 @@ jobs:
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "channel=${CHANNEL}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# The public release's name, and whether this run makes the release.
|
||||
# Only a PUSH to main does: a dispatch on main rebuilds the private
|
||||
# channel and publishes nothing outside this forge.
|
||||
{
|
||||
echo "EXPORT=${RUNNER_TEMP}/export"
|
||||
echo "NAME=$(date -u -d "@$(git log -1 --format=%ct HEAD)" +%Y.%m.%d.%H%M)"
|
||||
if [ "${GITHUB_EVENT_NAME}" = "push" ] && [ "${GITHUB_REF}" = "refs/heads/main" ]; then
|
||||
echo "PUBLIC=true"
|
||||
else
|
||||
echo "PUBLIC=false"
|
||||
fi
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
# What a release would publish: the export, and its changelog. Neither
|
||||
# may carry a banned word or a private record id (ci/leakgate.sh), and the
|
||||
# export carries no CI file.
|
||||
- name: Export, changelog and leak gate
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf "${EXPORT}"
|
||||
mkdir -p "${EXPORT}"
|
||||
git archive HEAD | tar -x -C "${EXPORT}"
|
||||
for private in .gitea .forgejo .github ci ci-requirements.md .gitattributes renovate.json; do
|
||||
if [ -e "${EXPORT}/${private}" ]; then
|
||||
echo "::error::the export carries ${private}; .gitattributes export-ignore no longer covers it"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
bash ci/changelog.sh "${RUNNER_TEMP}/changelog"
|
||||
echo "--- the public changelog of v${NAME} ---"
|
||||
cat "${RUNNER_TEMP}/changelog/public.md"
|
||||
echo "---"
|
||||
bash ci/leakgate.sh "${EXPORT}" "${RUNNER_TEMP}/changelog/public.md"
|
||||
|
||||
# The secrets the public half needs, checked before anything is pushed
|
||||
# anywhere. A dev push warns about one that is missing or refused; a main
|
||||
# push stops. Nothing here writes: the push token reads the public
|
||||
# repository, and the forge token updates a release that does not exist.
|
||||
- name: Public release secrets
|
||||
shell: bash
|
||||
env:
|
||||
PUBLIC_PUSH_TOKEN: ${{ secrets.PUBLIC_PUSH_TOKEN }}
|
||||
GHCR_USER: ${{ vars.GHCR_USER || secrets.GHCR_USER }}
|
||||
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
|
||||
FORGE_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
run: |
|
||||
set -u
|
||||
bad=""
|
||||
say() { bad="yes"; if [ "${PUBLIC}" = "true" ]; then echo "::error::$1"; else echo "::warning::$1"; fi; }
|
||||
[ -n "${GHCR_USER}" ] || say "GHCR_USER is empty or unset (an Actions variable or secret)"
|
||||
[ -n "${GHCR_TOKEN}" ] || say "the GHCR_TOKEN secret is empty or unset"
|
||||
if [ -z "${PUBLIC_PUSH_TOKEN}" ]; then
|
||||
say "the PUBLIC_PUSH_TOKEN secret is empty or unset"
|
||||
else
|
||||
auth="$(printf 'x-access-token:%s' "${PUBLIC_PUSH_TOKEN}" | base64 -w0)"
|
||||
echo "::add-mask::${auth}"
|
||||
git -c http.https://github.com/.extraheader="AUTHORIZATION: basic ${auth}" \
|
||||
ls-remote "https://github.com/${PUBLIC_REPO}.git" >/dev/null \
|
||||
|| say "PUBLIC_PUSH_TOKEN cannot read github.com/${PUBLIC_REPO}"
|
||||
fi
|
||||
node ci/releases.mjs forge-probe || say "CI_TOKEN may not write this repository's releases"
|
||||
if [ -n "${bad}" ] && [ "${PUBLIC}" = "true" ]; then exit 1; fi
|
||||
exit 0
|
||||
|
||||
- name: Registry login
|
||||
if: steps.guard.outputs.ready == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "${{ secrets.CI_TOKEN }}" \
|
||||
@@ -839,7 +750,6 @@ jobs:
|
||||
|
||||
- name: Download signed APK artifact
|
||||
# android-release just produced this, on every ref.
|
||||
if: steps.guard.outputs.ready == 'true'
|
||||
# Consuming half of the pair: stock download-artifact, which works here for
|
||||
# the same reason as the upload (gitea/runner 3.x edits the GHES refusal
|
||||
# out of the bundle). v8 runs on node24, which every CI-runner image
|
||||
@@ -849,8 +759,8 @@ jobs:
|
||||
name: minstrel-apk
|
||||
path: client/
|
||||
|
||||
# Into the export, which is what the image is built from.
|
||||
- name: Stage bundled APK + version sidecar
|
||||
if: steps.guard.outputs.ready == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
# All three pulled from android-release's outputs so the sidecar the
|
||||
@@ -864,15 +774,15 @@ jobs:
|
||||
# The artifact lands as `app-release.apk` (the original Gradle
|
||||
# output name). The Dockerfile COPYs client/* into /app/client/
|
||||
# and the server reads minstrel.apk + minstrel.apk.version.
|
||||
mv client/app-release.apk client/minstrel.apk
|
||||
mv client/app-release.apk "${EXPORT}/client/minstrel.apk"
|
||||
printf '{"name":"%s","code":%s,"channel":"%s"}\n' \
|
||||
"${APK_VERSION_NAME}" "${APK_VERSION_CODE}" "${APK_CHANNEL}" \
|
||||
> client/minstrel.apk.version
|
||||
cat client/minstrel.apk.version
|
||||
ls -lh client/
|
||||
> "${EXPORT}/client/minstrel.apk.version"
|
||||
cat "${EXPORT}/client/minstrel.apk.version"
|
||||
ls -lh "${EXPORT}/client/"
|
||||
|
||||
- name: Build and push
|
||||
if: steps.guard.outputs.ready == 'true'
|
||||
shell: bash
|
||||
# --pull: the Dockerfile's base images are floating tags (golang:1.26,
|
||||
# debian:bookworm-slim). Without it the runner's daemon reuses
|
||||
# whatever it cached, and the shipped binary can sit on a Go patch
|
||||
@@ -882,262 +792,127 @@ jobs:
|
||||
docker buildx build --pull \
|
||||
--build-arg MINSTREL_VERSION="${{ steps.tags.outputs.version }}" \
|
||||
--build-arg MINSTREL_CHANNEL="${{ steps.tags.outputs.channel }}" \
|
||||
--push ${{ steps.tags.outputs.args }} .
|
||||
--push ${{ steps.tags.outputs.args }} "${EXPORT}"
|
||||
|
||||
# The public release image, process #7881's release step 4.
|
||||
#
|
||||
# Runs only on a dispatch with ghcr_release ticked, never on a push. It
|
||||
# builds from `git archive HEAD`, the same tree the public repo's release
|
||||
# commit holds, so nothing export-ignored (.gitea/, ci/) reaches the
|
||||
# image's build context, and the image's labels name the public repo and
|
||||
# the public commit rather than this workbench.
|
||||
#
|
||||
# Tags: :<version> (rule 149's name, v<name> is the public git tag) and
|
||||
# :latest. :<version> is pushed once and never re-pushed; a re-run only
|
||||
# moves :latest. The private registry gets nothing from this job.
|
||||
#
|
||||
# ghcr_dry_run (the default) builds and checks everything and pushes
|
||||
# nothing, so the job can be proved on dev before a release exists. A real
|
||||
# run must be on main and needs the public tag to exist already: the
|
||||
# exported tree is compared with the tag's tree and refused on a mismatch.
|
||||
ghcr-release:
|
||||
name: Publish the release image to GHCR (dispatch only)
|
||||
needs: [go, integration, web, android, govulncheck, android-release]
|
||||
if: >-
|
||||
${{
|
||||
!cancelled()
|
||||
&& github.event_name == 'workflow_dispatch'
|
||||
&& github.event.inputs.ghcr_release == 'true'
|
||||
&& needs.go.result == 'success'
|
||||
&& needs.integration.result == 'success'
|
||||
&& needs.web.result == 'success'
|
||||
&& needs.android.result == 'success'
|
||||
&& needs.govulncheck.result == 'success'
|
||||
&& needs.android-release.result == 'success' }}
|
||||
runs-on: go-ci
|
||||
container:
|
||||
image: git.fabledsword.com/bvandeusen/ci-go:1.26
|
||||
|
||||
env:
|
||||
PUBLIC_IMAGE: ghcr.io/fabled-sword/minstrel
|
||||
PUBLIC_REPO: https://github.com/Fabled-Sword/minstrel
|
||||
# Anything but an explicit false is a dry run.
|
||||
DRY_RUN: ${{ github.event.inputs.ghcr_dry_run != 'false' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Full history: ci/version.sh derives the name from commit times.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Name the release
|
||||
id: name
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION="$(ci/version.sh HEAD | sed -n 's/^name=//p')"
|
||||
if [ -z "${VERSION}" ]; then
|
||||
echo "::error::could not derive a release name from ci/version.sh"
|
||||
exit 1
|
||||
fi
|
||||
if [ "${DRY_RUN}" != "true" ] && [ "${GITHUB_REF}" != "refs/heads/main" ]; then
|
||||
echo "::error::a real GHCR release runs on main; this is ${GITHUB_REF}. Dispatch on main, or leave ghcr_dry_run ticked."
|
||||
exit 1
|
||||
fi
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::Release ${VERSION} (public tag v${VERSION}), dry run: ${DRY_RUN}"
|
||||
|
||||
- name: Export the public tree and match it to the public tag
|
||||
id: export
|
||||
# THE PUBLIC RELEASE, a push to main only. The export becomes one commit
|
||||
# on the public repository's main, replacing its whole tree so removed
|
||||
# files go too, tagged v<name>. Author, committer and tagger are the
|
||||
# project's public identity, dated at this commit's time in UTC.
|
||||
#
|
||||
# A re-run finds v<name> already there: on the same tree it goes on to the
|
||||
# image and the releases, on a different tree it stops. A published tag
|
||||
# is never moved.
|
||||
- name: Public commit and tag
|
||||
if: env.PUBLIC == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
TAG: ${{ steps.name.outputs.tag }}
|
||||
PUBLIC_PUSH_TOKEN: ${{ secrets.PUBLIC_PUSH_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
EXPORT="${RUNNER_TEMP}/export"
|
||||
rm -rf "${EXPORT}"
|
||||
mkdir -p "${EXPORT}"
|
||||
git archive HEAD | tar -x -C "${EXPORT}"
|
||||
for private in .gitea ci ci-requirements.md; do
|
||||
if [ -e "${EXPORT}/${private}" ]; then
|
||||
echo "::error::the export carries ${private}; .gitattributes export-ignore no longer covers it"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# The tree hash of exactly what was exported. -f because some
|
||||
# tracked files are also ignored (android/.idea, the generated token
|
||||
# CSS): the public commit has to be staged with -f too, or it drops
|
||||
# them and this match refuses the release.
|
||||
cd "${EXPORT}"
|
||||
git init -q
|
||||
auth="$(printf 'x-access-token:%s' "${PUBLIC_PUSH_TOKEN}" | base64 -w0)"
|
||||
echo "::add-mask::${auth}"
|
||||
pub="${RUNNER_TEMP}/public"
|
||||
rm -rf "${pub}"
|
||||
git init -q -b main "${pub}"
|
||||
cd "${pub}"
|
||||
git config http.https://github.com/.extraheader "AUTHORIZATION: basic ${auth}"
|
||||
git remote add origin "https://github.com/${PUBLIC_REPO}.git"
|
||||
# An empty repository has no main yet, and its first release starts it.
|
||||
if [ -n "$(git ls-remote --heads origin main)" ]; then
|
||||
git fetch -q --depth 1 origin main
|
||||
git checkout -q -B main FETCH_HEAD
|
||||
fi
|
||||
find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
# A fresh archive, not the build context, which also holds the app.
|
||||
git -C "${GITHUB_WORKSPACE}" archive HEAD | tar -xf -
|
||||
# -f: the export exactly, a tracked file a .gitignore matches
|
||||
# (the generated token CSS) included.
|
||||
git add -A -f
|
||||
TREE="$(git write-tree)"
|
||||
echo "::notice::export tree ${TREE}"
|
||||
|
||||
if git fetch -q --depth 1 "${PUBLIC_REPO}" "refs/tags/${TAG}:refs/tags/${TAG}" 2>/dev/null; then
|
||||
PUBLIC_TREE="$(git rev-parse "${TAG}^{tree}")"
|
||||
REVISION="$(git rev-parse "${TAG}^{commit}")"
|
||||
if [ "${PUBLIC_TREE}" != "${TREE}" ]; then
|
||||
echo "::error::${PUBLIC_REPO} tag ${TAG} holds tree ${PUBLIC_TREE}, but this commit exports ${TREE}. The public release commit is not this export."
|
||||
tree="$(git write-tree)"
|
||||
when="@$(git -C "${GITHUB_WORKSPACE}" log -1 --format=%ct HEAD) +0000"
|
||||
if [ -n "$(git ls-remote --tags origin "refs/tags/v${NAME}")" ]; then
|
||||
git fetch -q --depth 1 origin "refs/tags/v${NAME}:refs/tags/v${NAME}"
|
||||
if [ "$(git rev-parse "v${NAME}^{tree}")" != "${tree}" ]; then
|
||||
echo "::error::the public tag v${NAME} holds another tree; a published tag is never moved"
|
||||
exit 1
|
||||
fi
|
||||
echo "::notice::public ${TAG} is commit ${REVISION}, and its tree matches the export"
|
||||
elif [ "${DRY_RUN}" = "true" ]; then
|
||||
REVISION=unreleased
|
||||
echo "::notice::${TAG} is not on ${PUBLIC_REPO} yet; a dry run labels the image revision=unreleased"
|
||||
echo "::notice::v${NAME} is already published with this tree"
|
||||
else
|
||||
echo "::error::${TAG} is not on ${PUBLIC_REPO}. Push the public release commit and its tag first (#8209), then run this."
|
||||
exit 1
|
||||
export GIT_AUTHOR_NAME=AmateurDungeoneer GIT_AUTHOR_EMAIL=amateurdungeoneer@fabledsword.com
|
||||
export GIT_COMMITTER_NAME=AmateurDungeoneer GIT_COMMITTER_EMAIL=amateurdungeoneer@fabledsword.com
|
||||
export GIT_AUTHOR_DATE="${when}" GIT_COMMITTER_DATE="${when}"
|
||||
git commit -q -m "Release ${NAME}"
|
||||
git tag -a "v${NAME}" -m "Release ${NAME}"
|
||||
git push -q origin main "refs/tags/v${NAME}"
|
||||
fi
|
||||
rm -rf .git
|
||||
echo "dir=${EXPORT}" >> "$GITHUB_OUTPUT"
|
||||
echo "revision=${REVISION}" >> "$GITHUB_OUTPUT"
|
||||
echo "REVISION=$(git rev-parse "v${NAME}^{commit}")" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Download signed APK artifact
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: minstrel-apk
|
||||
path: client/
|
||||
|
||||
- name: Stage the APK and its version sidecar into the export
|
||||
# The same export, built again with the release's name and labels that
|
||||
# point at the public repository and commit, so nothing in the image
|
||||
# points back here. Every layer but the stamped binary comes from the
|
||||
# build above. --provenance=false and no SBOM: an attestation would carry
|
||||
# this workbench's build details into a public registry.
|
||||
- name: Public image
|
||||
if: env.PUBLIC == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
APK_VERSION_NAME: ${{ needs.android-release.outputs.version_name }}
|
||||
APK_VERSION_CODE: ${{ needs.android-release.outputs.version_code }}
|
||||
APK_CHANNEL: ${{ needs.android-release.outputs.channel }}
|
||||
EXPORT: ${{ steps.export.outputs.dir }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
mv client/app-release.apk "${EXPORT}/client/minstrel.apk"
|
||||
printf '{"name":"%s","code":%s,"channel":"%s"}\n' \
|
||||
"${APK_VERSION_NAME}" "${APK_VERSION_CODE}" "${APK_CHANNEL}" \
|
||||
> "${EXPORT}/client/minstrel.apk.version"
|
||||
cat "${EXPORT}/client/minstrel.apk.version"
|
||||
|
||||
- name: Build the release image from the export
|
||||
shell: bash
|
||||
env:
|
||||
VERSION: ${{ steps.name.outputs.version }}
|
||||
REVISION: ${{ steps.export.outputs.revision }}
|
||||
CHANNEL: ${{ needs.android-release.outputs.channel }}
|
||||
EXPORT: ${{ steps.export.outputs.dir }}
|
||||
# --provenance=false and no SBOM: an attestation would carry the
|
||||
# workbench's build details into a public registry.
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build --pull --provenance=false \
|
||||
--build-arg MINSTREL_VERSION="${VERSION}" \
|
||||
--build-arg MINSTREL_CHANNEL="${CHANNEL}" \
|
||||
--label org.opencontainers.image.source="${PUBLIC_REPO}" \
|
||||
--label org.opencontainers.image.revision="${REVISION}" \
|
||||
--label org.opencontainers.image.version="${VERSION}" \
|
||||
-t "${PUBLIC_IMAGE}:${VERSION}" -t "${PUBLIC_IMAGE}:latest" \
|
||||
"${EXPORT}"
|
||||
docker image inspect --format '{{json .Config.Labels}}' "${PUBLIC_IMAGE}:${VERSION}"
|
||||
|
||||
- name: Push to GHCR
|
||||
shell: bash
|
||||
env:
|
||||
VERSION: ${{ steps.name.outputs.version }}
|
||||
# GHCR_USER is read from an Actions variable, or from a secret of
|
||||
# that name where no variable reaches the job.
|
||||
GHCR_USER: ${{ vars.GHCR_USER || secrets.GHCR_USER }}
|
||||
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ "${DRY_RUN}" = "true" ]; then
|
||||
echo "::notice::dry run: ${PUBLIC_IMAGE}:${VERSION} and :latest built, nothing pushed"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "${GHCR_USER}" ]; then echo "::error::GHCR_USER is empty: set it as an Actions variable or secret"; exit 1; fi
|
||||
if [ -z "${GHCR_TOKEN}" ]; then echo "::error::the Actions secret GHCR_TOKEN is empty"; exit 1; fi
|
||||
docker build --provenance=false \
|
||||
--build-arg MINSTREL_VERSION="${NAME}" \
|
||||
--build-arg MINSTREL_CHANNEL=stable \
|
||||
--label "org.opencontainers.image.source=https://github.com/${PUBLIC_REPO}" \
|
||||
--label "org.opencontainers.image.revision=${REVISION}" \
|
||||
--label "org.opencontainers.image.version=${NAME}" \
|
||||
-t "${PUBLIC_IMAGE}:${NAME}" "${EXPORT}"
|
||||
labelled="$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' "${PUBLIC_IMAGE}:${NAME}")"
|
||||
test "${labelled}" = "${REVISION}" || { echo "::error::the image names commit ${labelled}, not ${REVISION}"; exit 1; }
|
||||
printf '%s' "${GHCR_TOKEN}" | docker login ghcr.io -u "${GHCR_USER}" --password-stdin
|
||||
if docker manifest inspect "${PUBLIC_IMAGE}:${VERSION}" > /dev/null 2>&1; then
|
||||
echo "::notice::${PUBLIC_IMAGE}:${VERSION} is already published and is never re-pushed; moving :latest only"
|
||||
# :<name> is never re-pushed, so a re-run only moves :latest.
|
||||
if docker manifest inspect "${PUBLIC_IMAGE}:${NAME}" >/dev/null 2>&1; then
|
||||
echo "::notice::${PUBLIC_IMAGE}:${NAME} is already published; only :latest moves"
|
||||
else
|
||||
docker push "${PUBLIC_IMAGE}:${VERSION}"
|
||||
docker push "${PUBLIC_IMAGE}:${NAME}"
|
||||
fi
|
||||
docker tag "${PUBLIC_IMAGE}:${NAME}" "${PUBLIC_IMAGE}:latest"
|
||||
docker push "${PUBLIC_IMAGE}:latest"
|
||||
docker image inspect --format '{{json .RepoDigests}}' "${PUBLIC_IMAGE}:${VERSION}"
|
||||
echo "DIGEST=$(docker inspect --format '{{ index .RepoDigests 0 }}' "${PUBLIC_IMAGE}:${NAME}")" >> "$GITHUB_ENV"
|
||||
|
||||
# Verifies a tag release actually ended up complete, and names the specific
|
||||
# thing that's missing if not.
|
||||
#
|
||||
# A release can be incomplete while looking fine. If android-release never
|
||||
# starts (a runner failing to launch), its steps all report `failure` with
|
||||
# none executed and image-release shows `skipped`. The run is red, but the
|
||||
# release page renders and main's own push build has already moved
|
||||
# `:latest`, so a release missing its APK and its image is easy to skim
|
||||
# past.
|
||||
#
|
||||
# This job cannot prevent that; it turns an incomplete release into an
|
||||
# explicit, named error instead of a row of mystery step failures.
|
||||
#
|
||||
# `if: always()` is the whole point: it has to report precisely when the jobs
|
||||
# above did NOT succeed.
|
||||
verify-release:
|
||||
name: Verify release artifacts (tag releases only)
|
||||
needs: [android-release, release-assets, image-release]
|
||||
if: ${{ always() && startsWith(github.ref, 'refs/tags/v') }}
|
||||
runs-on: go-ci
|
||||
container:
|
||||
image: git.fabledsword.com/bvandeusen/ci-go:1.26
|
||||
|
||||
steps:
|
||||
- name: Release must have an APK attached
|
||||
# The release pages, each created or updated in place: GitHub's with the
|
||||
# public changelog, this forge's with the private one, tagging this
|
||||
# commit. Both name the image. No files are attached: the app ships
|
||||
# inside the image.
|
||||
- name: Public and private releases
|
||||
if: env.PUBLIC == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
PUBLIC_PUSH_TOKEN: ${{ secrets.PUBLIC_PUSH_TOKEN }}
|
||||
FORGE_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
REPO="${GITHUB_REPOSITORY}"
|
||||
cl="${RUNNER_TEMP}/changelog"
|
||||
for side in public private; do
|
||||
{
|
||||
cat "${cl}/${side}.md"
|
||||
printf '\nImage: `%s:%s`\n' "${PUBLIC_IMAGE}" "${NAME}"
|
||||
} > "${cl}/${side}-body.md"
|
||||
done
|
||||
echo "GITHUB_RELEASE=$(node ci/releases.mjs github "v${NAME}" "${cl}/public-body.md")" >> "$GITHUB_ENV"
|
||||
echo "FORGE_RELEASE=$(node ci/releases.mjs forge "v${NAME}" "${cl}/private-body.md" "${GITHUB_SHA}")" >> "$GITHUB_ENV"
|
||||
|
||||
REL_JSON="$(curl -fsSL \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
"https://git.fabledsword.com/api/v1/repos/${REPO}/releases/tags/${TAG}" || true)"
|
||||
if [ -z "${REL_JSON}" ]; then
|
||||
echo "::error::no release found for ${TAG} — the tag exists but nothing was published"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APK="$(printf '%s' "${REL_JSON}" \
|
||||
| grep -oP '"browser_download_url":\s*"\K[^"]+' \
|
||||
| grep -E '\.apk$' | head -1 || true)"
|
||||
if [ -z "${APK}" ]; then
|
||||
echo "::error::release ${TAG} has NO APK attached — in-app update will offer nothing, and the bundled-APK path on future :latest builds has no source."
|
||||
echo "::error::Fix by RE-RUNNING this workflow run. Do NOT delete and re-create the tag; if it fails again the runner never started the container, and the evidence is in act_runner on the host (Gitea will hold no job log)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "::notice::APK attached: ${APK}"
|
||||
|
||||
# The other half. Checking only the APK would report success on a release
|
||||
# whose image push failed. `always()` on this job means it runs even when
|
||||
# image-release failed, so without this the guard would cheerfully verify
|
||||
# an incomplete release.
|
||||
#
|
||||
# The image checked is the :<sha> rollback target, which main's own build
|
||||
# published for this same commit before the tag was cut (there are no
|
||||
# version image tags). It catches an image push that silently did not
|
||||
# happen, and it proves the ORDERING — a tag cut on a commit whose main
|
||||
# build never completed has no rollback target, and that is worth failing
|
||||
# on rather than discovering during an incident.
|
||||
- name: Rollback image must exist for the tagged commit
|
||||
# The record the release task keeps.
|
||||
- name: Published
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IMAGE="git.fabledsword.com/bvandeusen/minstrel"
|
||||
|
||||
echo "${{ secrets.CI_TOKEN }}" \
|
||||
| docker login git.fabledsword.com -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
if ! docker manifest inspect "${IMAGE}:${GITHUB_SHA}" > /dev/null 2>&1; then
|
||||
echo "::error::image ${IMAGE}:${GITHUB_SHA} does not exist — this commit has no rollback target."
|
||||
echo "::error::That image is published by the MAIN build of this commit, not by the tag build. If main's build never ran or failed, fix that first; a release whose commit cannot be rolled back to is the thing this check exists to refuse."
|
||||
exit 1
|
||||
echo "pushed ${{ steps.tags.outputs.args }}"
|
||||
if [ "${PUBLIC}" = "true" ]; then
|
||||
echo "release v${NAME} of workbench ${GITHUB_SHA}"
|
||||
echo "public commit ${REVISION}"
|
||||
echo "image ${DIGEST}"
|
||||
echo "GitHub release ${GITHUB_RELEASE}"
|
||||
echo "forge release ${FORGE_RELEASE}"
|
||||
else
|
||||
echo "dry run of release v${NAME}: export, changelog and leak gate passed, image built from the export"
|
||||
fi
|
||||
echo "::notice::rollback target verified: ${IMAGE}:${GITHUB_SHA}"
|
||||
|
||||
Reference in New Issue
Block a user