Skip to content

ci: tag-align Release Artifact workflow_dispatch path#3

Merged
NWarila merged 1 commit into
mainfrom
ci/harden-release-artifact-tag-alignment
May 4, 2026
Merged

ci: tag-align Release Artifact workflow_dispatch path#3
NWarila merged 1 commit into
mainfrom
ci/harden-release-artifact-tag-alignment

Conversation

@NWarila
Copy link
Copy Markdown
Contributor

@NWarila NWarila commented May 4, 2026

Summary

Harden the Release Artifact workflow so dispatched runs always build, attest, and publish against the input tag's commit -- not whatever HEAD the dispatched ref happened to be at trigger time.

Background

The just-published v1.0.0 release recorded `commit: d23df5d` (the workflow's main HEAD at dispatch time) in its release.json metadata, even though the v1.0.0 tag points at `3d6f57c`. The bundle SHA matched the consumer's pin because `src/` was identical between main and the tag, but the metadata mismatch was real. This change prevents the same drift on any future re-dispatch.

What changed

  1. Added a "Resolve release tag and align working tree" step right after checkout. It:

    • Determines `RELEASE_TAG` from `GITHUB_REF_NAME` (push) or `inputs.release_tag` (dispatch).
    • Verifies the tag exists; fails loudly if not.
    • Resolves the tag's commit (`git rev-list -n 1 refs/tags/$tag`, works for both annotated and lightweight tags).
    • Realigns the working tree to that commit when it differs from `GITHUB_SHA`, so the build below produces bytes from the tag's source.
    • Exports `RELEASE_TAG` and `RELEASE_COMMIT` to `GITHUB_ENV`.
  2. Simplified `Create Release Metadata` and `Create GitHub Release` to use the resolved env vars instead of branching on `GITHUB_EVENT_NAME` themselves.

  3. release-create now always uses `--verify-tag` (defensive) plus explicit `--target ${RELEASE_COMMIT}`. Push and dispatch share one code path.

Effect on existing v1.0.0 release

Intentionally not touched. Re-publishing would require deleting a public release on shared infrastructure for cosmetic gain only — the bundle SHA matches the consumer's pin and the consumer build will succeed.

Test plan

  • Merge this PR.
  • Confirm the next tag push (or dispatch of any existing tag) produces a release whose `release.json` records the tag's commit, not the workflow ref's commit.
  • No behavior change on tag-push runs (already tag-aligned).

🤖 Generated with Claude Code

Harden the Release Artifact workflow so dispatched runs always build,
attest, and publish against the input tag's commit -- not whatever HEAD
the dispatched ref happened to be at trigger time.

What changed:
- Added an early "Resolve release tag and align working tree" step that:
  - Determines RELEASE_TAG from GITHUB_REF_NAME (push) or inputs.release_tag
    (dispatch).
  - Verifies the tag exists, resolves its commit, and -- when the runner's
    working tree is on a different commit (always the case for a dispatch
    run from main) -- checks out the tag's commit so the build below
    produces bytes from the tag's source state.
  - Exports RELEASE_TAG and RELEASE_COMMIT to the env for downstream steps.
- Simplified the Create Release Metadata and Create GitHub Release steps
  to use the resolved env vars instead of branching on GITHUB_EVENT_NAME.
- The release-create step now uses --verify-tag in both modes (defensive
  against missing tags) and explicitly passes --target ${RELEASE_COMMIT}.

Why this matters:
- The previous v1.0.0 release recorded commit d23df5d (workflow's main
  HEAD at dispatch time) instead of 3d6f57c (the v1.0.0 tag's commit),
  because --target ${GITHUB_SHA} in dispatch mode pinned to the workflow
  ref. The bundle bytes happened to match because src/ was identical
  between main and the tag, but the metadata mismatch was real.
- After this change, any future dispatch of an existing tag will produce
  a release with metadata, attestation, and target all anchored to the
  tag's commit. Tag-push runs are unchanged in behavior.

The existing v1.0.0 release is intentionally left as-is. Re-publishing it
would require deleting the published release, which is destructive on
shared infrastructure for cosmetic gain only -- the bundle SHA matches
the consumer's pin and the consumer build will succeed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NWarila NWarila merged commit 45a666b into main May 4, 2026
5 checks passed
@NWarila NWarila deleted the ci/harden-release-artifact-tag-alignment branch May 4, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant