Run release.yml directly on release:published instead of a dispatcher workflow. Remove per-arch tags from GHCR after the manifest merge so only X.Y.Z remains visible to operators. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
name: release-on-publish
|
|
||||||
|
|
||||||
# Listens for a published GitHub Release and starts release.yml via
|
|
||||||
# workflow_dispatch. GitHub documents that workflow_dispatch always creates a
|
|
||||||
# new run (even when triggered by GITHUB_TOKEN), unlike some release:published
|
|
||||||
# deliveries that never started release.yml in this repo (see repo events API
|
|
||||||
# 2026-08-14T16:44:21Z vs Actions run list).
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
actions: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dispatch:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Derive SemVer from release tag
|
|
||||||
id: version
|
|
||||||
env:
|
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
raw="${RELEASE_TAG#v}"
|
|
||||||
if ! [[ "$raw" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
||||||
echo "::error::release tag is not SemVer vX.Y.Z (${RELEASE_TAG})"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
#region agent log
|
|
||||||
echo "::group::agent-log release-on-publish"
|
|
||||||
echo "release_tag=${RELEASE_TAG} version=${raw} release_id=${{ github.event.release.id }} draft=${{ github.event.release.draft }}"
|
|
||||||
echo "::endgroup::"
|
|
||||||
#endregion
|
|
||||||
echo "version=${raw}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Start release workflow
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
gh workflow run release.yml \
|
|
||||||
--repo "${{ github.repository }}" \
|
|
||||||
--ref main \
|
|
||||||
-f "version=${{ steps.version.outputs.version }}"
|
|
||||||
@@ -2,9 +2,8 @@ name: release
|
|||||||
|
|
||||||
# Publishes an immutable, version-tagged image on ghcr.io (spec 10.1).
|
# Publishes an immutable, version-tagged image on ghcr.io (spec 10.1).
|
||||||
# Ordinary commits and bare git tag pushes do not publish anything. A published
|
# Ordinary commits and bare git tag pushes do not publish anything. A published
|
||||||
# GitHub Release starts release-on-publish.yml, which dispatches this workflow
|
# GitHub Release runs this workflow directly (same pattern as gosentry / imap-scrub).
|
||||||
# with the release version. You can also run it manually via workflow_dispatch
|
# You can also run it manually via workflow_dispatch with an explicit SemVer X.Y.Z.
|
||||||
# with an explicit SemVer X.Y.Z version.
|
|
||||||
#
|
#
|
||||||
# Native per-architecture builds (see docs/development.md), not qemu:
|
# Native per-architecture builds (see docs/development.md), not qemu:
|
||||||
# running the full Postfix/OpenDKIM stack under emulation for the e2e gate
|
# running the full Postfix/OpenDKIM stack under emulation for the e2e gate
|
||||||
@@ -12,10 +11,12 @@ name: release
|
|||||||
# tag on its own native runner; a merge job then combines them into the one
|
# tag on its own native runner; a merge job then combines them into the one
|
||||||
# manifest tag documented in deploy/docker-compose.yml. "test, then push" (not
|
# manifest tag documented in deploy/docker-compose.yml. "test, then push" (not
|
||||||
# push-by-digest then test) is deliberate: it means the bytes that get tagged
|
# push-by-digest then test) is deliberate: it means the bytes that get tagged
|
||||||
# are exactly the bytes that passed e2e, at the cost of per-arch tags lingering
|
# are exactly the bytes that passed e2e. Per-arch tags are pushed only so
|
||||||
# in the registry as a side effect (harmless — the version tag's immutability,
|
# imagetools can assemble the multi-arch manifest; merge removes them from GHCR
|
||||||
# spec 10.1, is about that tag, not these).
|
# so operators see a single version tag (spec 10.1).
|
||||||
on:
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
@@ -37,20 +38,20 @@ jobs:
|
|||||||
id: version
|
id: version
|
||||||
env:
|
env:
|
||||||
INPUT_VERSION: ${{ github.event.inputs.version }}
|
INPUT_VERSION: ${{ github.event.inputs.version }}
|
||||||
|
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
raw="${INPUT_VERSION:-}"
|
if [ "$EVENT_NAME" = "release" ]; then
|
||||||
|
raw="${RELEASE_TAG:-}"
|
||||||
|
else
|
||||||
|
raw="${INPUT_VERSION:-}"
|
||||||
|
fi
|
||||||
raw="${raw#v}"
|
raw="${raw#v}"
|
||||||
if ! [[ "$raw" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
if ! [[ "$raw" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
echo "::error::release version is not SemVer X.Y.Z (event=${EVENT_NAME}; pass inputs.version on workflow_dispatch). Refusing to publish ghcr.io/${{ github.repository }}:${raw:-?}"
|
echo "::error::release version is not SemVer X.Y.Z (event=${EVENT_NAME}; tag=${RELEASE_TAG:-} input=${INPUT_VERSION:-}). Refusing to publish ghcr.io/${{ github.repository }}:${raw:-?}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
#region agent log
|
|
||||||
echo "::group::agent-log prepare version"
|
|
||||||
echo "event=${EVENT_NAME} version=${raw} checkout_ref=v${raw}"
|
|
||||||
echo "::endgroup::"
|
|
||||||
#endregion
|
|
||||||
echo "version=${raw}" >> "$GITHUB_OUTPUT"
|
echo "version=${raw}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@@ -136,24 +137,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: v${{ needs.prepare.outputs.version }}
|
ref: v${{ needs.prepare.outputs.version }}
|
||||||
|
|
||||||
- name: Debug — snapshot GitHub Release state (agent)
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
VERSION: ${{ needs.prepare.outputs.version }}
|
|
||||||
run: |
|
|
||||||
#region agent log
|
|
||||||
set -euo pipefail
|
|
||||||
tag="v${VERSION}"
|
|
||||||
echo "::group::agent-log release snapshot for ${tag}"
|
|
||||||
if out=$(gh release view "$tag" --repo "${{ github.repository }}" --json isDraft,tagName,publishedAt,url 2>&1); then
|
|
||||||
echo "release-exists: ${out}"
|
|
||||||
else
|
|
||||||
echo "release-missing: ${out}"
|
|
||||||
fi
|
|
||||||
echo "event=${{ github.event_name }} ref=${GITHUB_REF_NAME}"
|
|
||||||
echo "::endgroup::"
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to ghcr.io
|
- name: Log in to ghcr.io
|
||||||
@@ -181,12 +164,6 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
if [ "$rc" -eq 0 ]; then
|
if [ "$rc" -eq 0 ]; then
|
||||||
printf '%s\n' "$out"
|
printf '%s\n' "$out"
|
||||||
#region agent log
|
|
||||||
echo "::group::agent-log ghcr tags published"
|
|
||||||
echo "version=${{ needs.prepare.outputs.version }} event=${{ github.event_name }} ref=${GITHUB_REF_NAME}"
|
|
||||||
echo "tags_pushed=${{ needs.prepare.outputs.version }},${{ needs.prepare.outputs.version }}-amd64,${{ needs.prepare.outputs.version }}-arm64"
|
|
||||||
echo "::endgroup::"
|
|
||||||
#endregion
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
printf '%s\n' "$out" >&2
|
printf '%s\n' "$out" >&2
|
||||||
@@ -199,3 +176,23 @@ jobs:
|
|||||||
attempt=$((attempt + 1))
|
attempt=$((attempt + 1))
|
||||||
backoff=$((backoff * 2))
|
backoff=$((backoff * 2))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
- name: Remove per-arch tags from GHCR
|
||||||
|
# Side-effect tags for imagetools assembly only — not part of the public
|
||||||
|
# version surface (deploy/docker-compose.yml pins X.Y.Z, not X.Y.Z-amd64).
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
repo="ghcr.io/${{ github.repository }}"
|
||||||
|
version="${{ needs.prepare.outputs.version }}"
|
||||||
|
for suffix in amd64 arm64; do
|
||||||
|
tag="${repo}:${version}-${suffix}"
|
||||||
|
set +e
|
||||||
|
out=$(docker buildx imagetools rm "$tag" 2>&1)
|
||||||
|
rc=$?
|
||||||
|
set -e
|
||||||
|
if [ "$rc" -eq 0 ]; then
|
||||||
|
printf '%s\n' "$out"
|
||||||
|
else
|
||||||
|
echo "::warning::could not remove ${tag}: ${out}" >&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|||||||
+14
-13
@@ -205,9 +205,8 @@ the binaries so they cannot drift apart.
|
|||||||
local-trial image references) in the **same** release commit.
|
local-trial image references) in the **same** release commit.
|
||||||
2. Create and push git tag `vX.Y.Z` on that commit.
|
2. Create and push git tag `vX.Y.Z` on that commit.
|
||||||
3. Publish the GitHub Release for `vX.Y.Z` (not a draft).
|
3. Publish the GitHub Release for `vX.Y.Z` (not a draft).
|
||||||
4. Workflow [release-on-publish.yml](../.github/workflows/release-on-publish.yml)
|
4. Workflow [release.yml](../.github/workflows/release.yml) builds, e2e-gates,
|
||||||
starts [release.yml](../.github/workflows/release.yml) with that version;
|
and publishes `ghcr.io/mixeme/selfpost:X.Y.Z` (checks out tag `vX.Y.Z`).
|
||||||
the build checks out tag `vX.Y.Z` (not `main` HEAD).
|
|
||||||
|
|
||||||
**GitHub Release vs GHCR.** The public [Releases](https://github.com/mixeme/selfpost/releases)
|
**GitHub Release vs GHCR.** The public [Releases](https://github.com/mixeme/selfpost/releases)
|
||||||
page lists only **published** releases. A draft is visible to maintainers only —
|
page lists only **published** releases. A draft is visible to maintainers only —
|
||||||
@@ -307,29 +306,31 @@ Workflows in [.github/workflows/](../.github/workflows/). What each job runs —
|
|||||||
|
|
||||||
### `release.yml` — published GitHub Release, or `workflow_dispatch` with SemVer
|
### `release.yml` — published GitHub Release, or `workflow_dispatch` with SemVer
|
||||||
|
|
||||||
Publishing a GitHub Release runs [release-on-publish.yml](../.github/workflows/release-on-publish.yml),
|
Publishing a GitHub Release runs `release.yml` directly (`release: published`,
|
||||||
which dispatches `release.yml` with the version parsed from the release tag.
|
same pattern as gosentry / imap-scrub). You can also run it manually via
|
||||||
You can also run `release.yml` manually via `workflow_dispatch` and an
|
`workflow_dispatch` with an explicit `X.Y.Z` input. A bare git tag push does not
|
||||||
explicit `X.Y.Z` input. A bare git tag push does not run either workflow.
|
run the workflow. The build always checks out `vX.Y.Z`, not `main` HEAD.
|
||||||
The build always checks out `vX.Y.Z`, not `main` HEAD.
|
|
||||||
|
|
||||||
`prepare` takes the version from the `workflow_dispatch` `version` input. A
|
`prepare` takes the version from `github.event.release.tag_name` on a release
|
||||||
dispatch whose input is missing or not `X.Y.Z` fails in `prepare`.
|
event, or from the `workflow_dispatch` `version` input. A dispatch whose input
|
||||||
|
is missing or not `X.Y.Z` fails in `prepare`.
|
||||||
|
|
||||||
```
|
```
|
||||||
release-on-publish (release: published → workflow_dispatch)
|
release: published
|
||||||
prepare (version from workflow_dispatch input; checkout vX.Y.Z)
|
prepare (version from release tag or workflow_dispatch input; checkout vX.Y.Z)
|
||||||
→ build [matrix: ubuntu-latest / ubuntu-24.04-arm]
|
→ build [matrix: ubuntu-latest / ubuntu-24.04-arm]
|
||||||
→ docker build --load (VERSION from prepare)
|
→ docker build --load (VERSION from prepare)
|
||||||
→ e2e (test/e2e)
|
→ e2e (test/e2e)
|
||||||
→ push ghcr.io/...:X.Y.Z-amd64 | X.Y.Z-arm64
|
→ push ghcr.io/...:X.Y.Z-amd64 | X.Y.Z-arm64
|
||||||
→ merge
|
→ merge
|
||||||
→ docker buildx imagetools create → unified manifest X.Y.Z
|
→ docker buildx imagetools create → unified manifest X.Y.Z
|
||||||
|
→ imagetools rm → drop X.Y.Z-amd64 and X.Y.Z-arm64 from GHCR
|
||||||
```
|
```
|
||||||
|
|
||||||
Native per-arch matrix (no QEMU): running the full Postfix/OpenDKIM stack under
|
Native per-arch matrix (no QEMU): running the full Postfix/OpenDKIM stack under
|
||||||
emulation for e2e is impractical. E2e first, then push — the registry receives
|
emulation for e2e is impractical. E2e first, then push — the registry receives
|
||||||
the bytes that passed the gate.
|
the bytes that passed the gate. Only `ghcr.io/mixeme/selfpost:X.Y.Z` remains
|
||||||
|
tagged in GHCR; per-arch names exist briefly during the merge job.
|
||||||
|
|
||||||
A failed e2e **blocks** image publication.
|
A failed e2e **blocks** image publication.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user