A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
ci(docker): publish version tags from branch releases
Amruth Pillaib700ed9d7309
diff --git a/.agents/docs/container-publishing.md b/.agents/docs/container-publishing.mdindex e68b79a51..7c6fd4e36 100644--- a/.agents/docs/container-publishing.md+++ b/.agents/docs/container-publishing.md@@ -25,7 +25,7 @@ Dockerfile's pnpm cache mounts between runs, keyed per architecture (`Dockerfile| Manual dispatch, default `release=false` | Build AMD64 and ARM64 | `sha-<full-commit>`, `canary-<run-id>-<attempt>` | No || Push of a stable `v*` tag | Promote existing SHA image | `latest`, version/major/minor (`v6.0.0`, `v6.0`, `v6`) | When configured: SSH redeploy and Cloudflare purge || Push of a prerelease `v*` tag | Promote existing SHA image | Prerelease version only (for example, `v6.0.0-rc.1`) | No |-| Manual dispatch, `release=true`, branch | Promote existing SHA image | `latest` | When configured: SSH redeploy and Cloudflare purge |+| Manual dispatch, `release=true`, branch | Promote existing SHA image | `latest`, version/major/minor from `package.json` | When configured: SSH redeploy and Cloudflare purge || Manual dispatch, `release=true`, stable tag | Promote existing SHA image | `latest`, version/major/minor (`v6.0.0`, `v6.0`, `v6`) | When configured: SSH redeploy and Cloudflare purge || Manual dispatch, `release=true`, prerelease tag | Promote existing SHA image | Prerelease version only | No |@@ -74,8 +74,10 @@ manual `release=false` build at that ref first, then rerun promotion. Historicalolder workflow files still run their original workflow; their short SHA tags are not promotionsources. Keep full SHA images in registry retention policies so commits remain promotable.-Manual `release=true` on main or another branch updates `latest` only, keeping semver-aliases tied to Git releases. To update `latest` to main without rebuilding:+Manual `release=true` on main or another branch promotes the branch head to `latest` and to+the full/minor/major aliases of its `package.json` version (a prerelease version updates only+its own alias and skips production integrations). Use it to republish a release with a fix+that landed after its Git tag, without rebuilding:```bashgh workflow run docker-build.yml --repo reactive-resume/reactive-resume --ref main -f release=truediff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.ymlindex 9350bbd5c..747c52741 100644--- a/.github/workflows/docker-build.yml+++ b/.github/workflows/docker-build.yml@@ -4,7 +4,7 @@ on:workflow_dispatch:inputs:release:- description: Promote existing SHA image (branch updates latest; release tag also updates semver) and redeploy production+ description: Promote existing SHA image to latest and its package.json version tags, and redeploy productiontype: booleandefault: falsepush:@@ -220,26 +220,24 @@ jobs:run: |set -euo pipefailversion=$(jq -r .version package.json)- prerelease=false- tagged=falseif [[ "$GIT_REF" == refs/tags/v* ]]; then- version="${GIT_REF#refs/tags/v}"- if [[ ! "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?$ ]]; then+ tag="${GIT_REF#refs/tags/v}"+ if [[ ! "$tag" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?$ ]]; thenecho "::error::Release tag must be vMAJOR.MINOR.PATCH, optionally with a prerelease suffix."exit 1fi- if [[ "$version" != "$(jq -r .version package.json)" ]]; then+ if [[ "$tag" != "$version" ]]; thenecho "::error::Release tag version must match package.json; promotion cannot change the built app version."exit 1fi- if [[ "$version" == *-* ]]; then prerelease=true; fi- tagged=truefi+ # A release from a branch publishes the same version aliases as its tag would: package.json names the version.+ prerelease=false+ if [[ "$version" == *-* ]]; then prerelease=true; fi{echo "version=$version"echo "sha=$(git rev-parse HEAD)"echo "prerelease=$prerelease"- echo "tagged=$tagged"} >> "$GITHUB_OUTPUT"- name: Require successful CI for the exact promotion commit@@ -294,9 +292,9 @@ jobs:type=raw,value=nightly,enable=${{ needs.mode.outputs.nightly == 'true' }}type=raw,value=nightly-{{date 'YYYYMMDDHHmmss' tz='UTC'}},enable=${{ needs.mode.outputs.nightly == 'true' }}type=raw,value=latest,enable=${{ needs.mode.outputs.release == 'true' && steps.version.outputs.prerelease != 'true' }}- type=raw,value=v${{ steps.version.outputs.version }},enable=${{ needs.mode.outputs.release == 'true' && steps.version.outputs.tagged == 'true' }}- type=raw,value=v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }},enable=${{ needs.mode.outputs.release == 'true' && steps.version.outputs.tagged == 'true' && steps.version.outputs.prerelease != 'true' }}- type=raw,value=v${{ steps.semver.outputs.major }},enable=${{ needs.mode.outputs.release == 'true' && steps.version.outputs.tagged == 'true' && steps.version.outputs.prerelease != 'true' }}+ type=raw,value=v${{ steps.version.outputs.version }},enable=${{ needs.mode.outputs.release == 'true' }}+ type=raw,value=v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }},enable=${{ needs.mode.outputs.release == 'true' && steps.version.outputs.prerelease != 'true' }}+ type=raw,value=v${{ steps.semver.outputs.major }},enable=${{ needs.mode.outputs.release == 'true' && steps.version.outputs.prerelease != 'true' }}- name: Create manifest list and pushid: manifestdiff --git a/tooling/docker-publishing.test.ts b/tooling/docker-publishing.test.tsindex f6b6d0e23..3ba93b5d6 100644--- a/tooling/docker-publishing.test.ts+++ b/tooling/docker-publishing.test.ts@@ -50,16 +50,17 @@ it("validates release tags against the built version and distinguishes prereleastry {writeFileSync(join(directory, "git"), `#!/usr/bin/env bash\necho ${commit}\n`, { mode: 0o755 });- for (const [event, ref, version, prerelease, tagged, status] of [- ["push", "refs/tags/v6.0.0", "6.0.0", "false", "true", 0],- ["push", "refs/tags/v6.0.0-rc.1", "6.0.0-rc.1", "true", "true", 0],- ["push", "refs/tags/v6.0.1", "6.0.0", "false", "true", 1],- ["push", "refs/tags/v6.0", "6.0.0", "false", "true", 1],- ["workflow_dispatch", "refs/heads/main", "6.0.0", "false", "false", 0],- ["workflow_dispatch", "refs/heads/fix", "6.0.0", "false", "false", 0],- ["workflow_dispatch", "refs/tags/v6.0.0", "6.0.0", "false", "true", 0],- ["workflow_dispatch", "refs/tags/v6.0.0-rc.1", "6.0.0-rc.1", "true", "true", 0],- ["workflow_dispatch", "refs/tags/v6.0.1", "6.0.0", "false", "true", 1],+ for (const [event, ref, version, prerelease, status] of [+ ["push", "refs/tags/v6.0.0", "6.0.0", "false", 0],+ ["push", "refs/tags/v6.0.0-rc.1", "6.0.0-rc.1", "true", 0],+ ["push", "refs/tags/v6.0.1", "6.0.0", "false", 1],+ ["push", "refs/tags/v6.0", "6.0.0", "false", 1],+ ["workflow_dispatch", "refs/heads/main", "6.0.0", "false", 0],+ ["workflow_dispatch", "refs/heads/main", "6.0.0-rc.1", "true", 0],+ ["workflow_dispatch", "refs/heads/fix", "6.0.0", "false", 0],+ ["workflow_dispatch", "refs/tags/v6.0.0", "6.0.0", "false", 0],+ ["workflow_dispatch", "refs/tags/v6.0.0-rc.1", "6.0.0-rc.1", "true", 0],+ ["workflow_dispatch", "refs/tags/v6.0.1", "6.0.0", "false", 1],] as const) {const output = join(directory, "output");writeFileSync(output, "");@@ -77,7 +78,7 @@ it("validates release tags against the built version and distinguishes prereleas});expect(result.status, result.stderr).toBe(status);expect(readFileSync(output, "utf8")).toBe(- status === 0 ? `version=${version}\nsha=${commit}\nprerelease=${prerelease}\ntagged=${tagged}\n` : "",+ status === 0 ? `version=${version}\nsha=${commit}\nprerelease=${prerelease}\n` : "",);}} finally {