Skip to content

ci: release from signed version tags - #31

Merged
uniqueg merged 4 commits into
mainfrom
ci/release-from-tags
Oct 31, 2026
Merged

uniqueg merged 4 commits into
mainfrom
ci/release-from-tags

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Releases of the shared actions now come from signed vX.Y.Z tags that the maintainer pushes, as in the other repositories (cloud-registry, proTES), instead of the automatic release after CI on main.

  • .github/workflows/release.yml (Release): on push: tags: ["v*"].
    • prepare / "Prepare release" checks that the tag is annotated and has a signature that GitHub verified, still points to the event commit, that the commit is on main and that CI passed for its push. It also runs release.sh check: the version is the next step after the last release, at least the step that the action commits need, the commit descends from the latest release on main, and it isn't released yet. Finally it runs release.sh lint on the curated notes docs/releases/vX.Y.Z.md.
    • publish / "Publish release" runs in the environment release and creates the release from the curated notes, followed by GitHub's generated notes under ## Commits and the Full Changelog line. A re-run when the release already exists is a no-op.
  • .github/scripts/release.sh: plan is replaced by check. notes becomes draft, which drafts the curated notes for the release-prep PR with a TODO line that you must remove. lint and notes are new (the release body). tests/release/test.sh is adapted and extended.
  • RELEASING.md is rewritten: when and how to release, the checks, what to do on failure, and the repository settings it relies on. The README sentence and the CI comments are updated too.

Callers don't change: they still pin to the commit of a vX.Y.Z tag, and Dependabot still bumps the pins.

Since review: only published releases count as previous releases, CI must have passed on main, --latest is set only for the highest version, release lookup errors fail, and unclosed code blocks and indented headings fail the lint.

Effect of merging: nothing is released. Merges to main no longer trigger anything, and the next release happens only when the maintainer pushes a tag. This PR changes nothing under actions/, so the old workflow wouldn't have released it either.

Closes #30

Verification

  • bash tests/release/test.sh, tests/gate/test.sh, tests/pr-title/test.sh: all pass.
  • pre-commit run --all-files: passes (actionlint, shellcheck, schemas, gitleaks). markdownlint couldn't run through pre-commit locally because of a nodeenv/node version error, so I ran npx [email protected] instead: 0 issues.
  • Not verified: an end-to-end run on a tag. GitHub behaviour such as tag signature verification via git/tags/<sha>, GITHUB_SHA on annotated tag pushes and --verify-tag needs a dry run in a fork on a test tag before the first tagged release.
  • CI: passed (Lint, Test, CodeQL, CI passed), also after the Sourcery fixes (4f8d836).

Declined review findings

  • Workflow-level checks (annotated tag, signature, CI lookup) have no unit tests. They are the same steps as in cloud-registry's release workflow; the fork dry run covers them.

  • Checking the notes and version in the CI of the release-prep PR: deferred. The version isn't known to CI. release.sh lint and check can be run locally before tagging.

  • Sourcery, unvalidated tags reach callers' Dependabot before prepare passes: this is inherent to tag-based releases and the same as in the other repositories. Only the maintainer can create tags, and only after the notes PR has passed.

  • Sourcery, re-runs of an older tag after a newer release fail in prepare: these re-runs have no use.

  • Sourcery, strict bullet grammar in the notes lint: it would reject legitimate notes, so the wording is reviewed in the release-prep PR instead.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Move shared action releases from automatic main-branch CI publishing to validated, signed version tags with curated release notes and maintainer approval.

New Features:

  • Require signed annotated version tags and maintainer approval before publishing shared action releases.
  • Add curated release notes with validation and append GitHub-generated changelog notes to release bodies.

Bug Fixes:

  • Prevent releases from proceeding when tags are invalid, commits are not on main, CI has not passed, versions are out of sequence, or release notes are unfinished.

Enhancements:

  • Replace automatic releases after main CI with an explicit tag-driven release workflow.
  • Update release tooling to validate published-release history and enforce semantic version progression.
  • Rewrite release documentation to describe the signed-tag release process and required repository settings.

CI:

  • Update CI documentation and release-script tests for tag-based release validation and curated notes.

Deployment:

  • Publish releases through a protected release environment with immutable, verified tags and correct latest-release designation.

Documentation:

  • Document release preparation, versioning, notes format, failure handling, and repository configuration.

Tests:

  • Extend release-script coverage for version checks, published releases, notes linting, and generated release bodies.

uniqueg and others added 3 commits October 31, 2026 05:39
Replace the automatic release after CI on main with a Release
workflow for signed vX.Y.Z tags pushed by the maintainer: prepare
checks the tag, version, curated notes and CI; publish creates the
release in the release environment. release.sh now checks tags,
drafts and lints curated notes and renders the release body.

Closes #30

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Require releases to follow the latest release on main, refuse a
second release of a commit and a moved tag, skip code blocks and
reject empty sections in the notes lint, mark drafts with a TODO,
make re-runs no-ops and document the repository settings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Releases are now explicitly initiated by maintainer-created signed version tags, with workflow gates for tag authenticity, main ancestry, exact-commit CI success, version correctness, curated notes, and environment approval; the release script and documentation/tests are updated to support and verify this process.

Sequence diagram for the signed tag release workflow

sequenceDiagram
    actor Maintainer
    participant GitHub as GitHub
    participant Prepare as Prepare release
    participant CI as CI workflow
    participant Publish as Publish release
    participant Release as GitHub Release

    Maintainer->>GitHub: git push origin vX.Y.Z
    GitHub->>Prepare: Trigger release.yml on push tag
    Prepare->>Prepare: git cat-file -t refs/tags/TAG
    Prepare->>GitHub: Verify tag signature via git/tags/<sha>
    Prepare->>Prepare: Check tag commit equals GITHUB_SHA
    Prepare->>Prepare: git merge-base --is-ancestor HEAD origin/main
    Prepare->>CI: Query successful push run for commit
    CI-->>Prepare: CI passed
    Prepare->>Prepare: release.sh check TAG SHA
    Prepare->>Prepare: release.sh lint TAG docs/releases/TAG.md
    Prepare-->>Publish: sha and previous release
    Publish->>GitHub: Wait for release environment approval
    Publish->>Publish: release.sh notes TAG previous SHA notes-file
    Publish->>Release: gh release create TAG --verify-tag
Loading

Flow diagram for release preparation gates

flowchart TD
    A[Maintainer pushes signed annotated vX.Y.Z tag] --> B[Trigger Release workflow]
    B --> C{Tag signature and annotation valid?}
    C -- No --> F[Fail before publishing]
    C -- Yes --> D{Commit is on main and CI passed for exact commit?}
    D -- No --> F
    D -- Yes --> E{release.sh check and lint pass?}
    E -- No --> F
    E -- Yes --> G[Approve release environment]
    G --> H[Create GitHub release from curated and generated notes]
    H --> I[Dependabot bumps caller commit pins]
Loading

Flow diagram for curated release notes

flowchart LR
    A[Commits since previous release] --> B[release.sh draft]
    B --> C[docs/releases/vX.Y.Z.md]
    C --> D[Maintainer reviews and removes TODO]
    D --> E[release.sh lint]
    E --> F[release.sh notes]
    G[GitHub generated notes] --> F
    F --> H[GitHub release body]
Loading

File-Level Changes

Change Details Files
Switch release automation from CI-triggered version planning to maintainer-pushed, signed version tags with gated validation and approval.
  • Trigger releases on pushed v* tags instead of successful main CI runs.
  • Validate annotated GitHub-verified signatures, tag commit ancestry, main membership, and successful CI for the exact commit.
  • Require sequential semantic versioning, unreleased commits, and curated notes before publishing.
  • Publish through the protected release environment and make existing-release retries idempotent.
.github/workflows/release.yml
RELEASING.md
README.md
.github/workflows/ci.yml
Refactor release scripting around explicit version checks, curated-note drafting and validation, and composed release bodies.
  • Replace plan with check to validate release ordering, required bump level, ancestry, and already-released commits.
  • Add draft generation with a review TODO and lint validation for title, intro, section order, and unfinished content.
  • Compose release bodies from curated notes followed by GitHub-generated commit and changelog notes.
  • Expand shell tests for version checks, note linting, draft generation, and release-body rendering.
.github/scripts/release.sh
tests/release/test.sh

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@uniqueg
uniqueg marked this pull request as ready for review October 31, 2026 05:03

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 11 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/release.yml" line_range="100" />
<code_context>
-      # before, and that the tag points to the commit after
-      - name: Create the release
-        if: steps.plan.outputs.tag != ''
+          runs="$(gh api "repos/${REPOSITORY}/actions/workflows/ci.yml/runs?head_sha=${SHA}&event=push&status=success&per_page=1" \
+            --jq .total_count)"
+          if [[ ! "${runs}" =~ ^[0-9]+$ || "${runs}" -lt 1 ]]; then
</code_context>
<issue_to_address>
**Other-branch CI runs count**

When a commit has a successful CI push run on another branch, is an ancestor of `main`, and has no successful CI push run for `main`, the run query filters by workflow, SHA, event, and status but not branch, so a successful `push` run from another branch satisfies the check even when CI for the commit’s push to `main` is absent or failed. The release can then be published without the required successful `main` CI run.

Filter the CI run query to `branch=main` so runs from other branches cannot satisfy the release check.
</issue_to_address>

### Comment 2
<location path=".github/workflows/release.yml" line_range="23" />
<code_context>
+# One run per tag, so that a run waiting for approval is not cancelled by
+# the run of another tag
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: false

</code_context>
<issue_to_address>
**Older release becomes latest**

When an older tag waits for approval while a newer release is published first, the publish job uses the `previous` value captured by `prepare` and does not recheck release order; the per-tag concurrency groups let both runs proceed independently, so publishing the older tag afterward makes it the latest release on GitHub.

Serialize publication across tags and recheck release order after approval before publishing.

Also at `.github/workflows/release.yml:139-140`.
</issue_to_address>

### Comment 3
<location path=".github/scripts/release.sh" line_range="78-79" />
<code_context>
-# The highest release tag on <commit> or its ancestors, or nothing. No early
-# exit in the pipeline, so that `git tag` never gets SIGPIPE
-last_release() {
-  git tag --merged "$1" --list 'v*' --sort=-v:refname \
-    | TAG_PATTERN="${tag_pattern}" awk '$0 ~ ENVIRON["TAG_PATTERN"] && !found { print; found = 1 }'
-}
</code_context>
<issue_to_address>
**Changes since last release disappear**

When a version tag fails preparation and a later version is released after the maintainer fixes the issue, `previous_release` treats the failed tag as a release, so `check` and `draft` use it as the range boundary and omit the changes since the last published release from the required version bump and release notes.

Have `previous_release` select published releases rather than every matching version tag.
</issue_to_address>

### Comment 4
<location path=".github/workflows/release.yml" line_range="15" />
<code_context>
-  schedule:
-    - cron: "23 5 * * 1"
+  push:
+    tags: ["v*"]

-permissions: {}
</code_context>
<issue_to_address>
**Unvalidated tags reach callers**

When a pushed version tag is awaiting approval or fails a preparation check, dependabot follows version tags, not successful completion of this workflow. It can therefore propose pins to the new commit as soon as the tag is pushed, before `prepare` checks it or `publish` receives approval; a tag that fails preparation remains available for callers to adopt.

Avoid exposing a Dependabot-visible version tag until it has passed validation and is ready to publish, or use a release process that prevents callers from adopting tags that have not passed those checks.
</issue_to_address>

### Comment 5
<location path=".github/scripts/release.sh" line_range="302" />
<code_context>
+  while IFS= read -r line; do
+    stripped="${line#"${line%%[![:space:]]*}"}"
+    if [[ "${stripped}" == '```'* || "${stripped}" == '~~~'* ]]; then
+      fenced=$((1 - fenced))
+      filled=1
+    elif ((fenced)); then
</code_context>
<issue_to_address>
**Unclosed fences pass validation**

When curated notes contain an unclosed fence or open one fence style and close the other, `lint` toggles `fenced` for apparent fences without requiring matching delimiters or checking the state at EOF, so invalid notes pass validation and the remaining release body renders as code.

Validate matching fence delimiters and reject notes if a fence remains open at EOF.

Also at `.github/scripts/release.sh:320-321`.
</issue_to_address>

### Comment 6
<location path=".github/workflows/release.yml" line_range="137" />
<code_context>
+            "docs/releases/${TAG}.md" > "${notes}"
+          cat "${notes}" >> "${GITHUB_STEP_SUMMARY}"
+          if gh release view "${TAG}" > /dev/null 2>&1; then
+            echo "::notice::The release ${TAG} exists already"
+          else
+            gh release create "${TAG}" --verify-tag --title "${TAG}" \
</code_context>
<issue_to_address>
**Release lookup errors are mishandled**

When `gh release view` fails for a reason other than the release not existing, the release step handles a lookup failure as an ordinary existing-or-absent result, so it either exits successfully without creating a release or attempts to create an already-existing release.

Distinguish a not-found response from other `gh release view` errors and fail on the latter.
</issue_to_address>

### Comment 7
<location path=".github/scripts/release.sh" line_range="113-114" />
<code_context>
+  # an ancestor (no release from an older commit, which would leave out
+  # later changes)
+  latest="$(previous_release "${release_branch}" "${tag}")"
+  [[ "${latest}" == "${previous}" ]] \
+    || die "${tag} isn't on a descendant of the latest release ${latest}"
+  if [[ -n "${previous}" && "$(git rev-parse "${previous}^{commit}")" == "${commit}" ]]; then
+    die "${commit} is released already as ${previous}"
</code_context>
<issue_to_address>
**Older release reruns fail**

When a release has already been published and a later version tag is pushed before the earlier workflow run is rerun, `check` compares the older tag’s previous release with the latest release on `origin/main` and fails. The workflow never reaches the publish job’s existing-release no-op check.

Allow an already-published tag to pass the prepare checks, or detect that its release exists before enforcing the latest-release comparison.
</issue_to_address>

### Comment 8
<location path=".github/scripts/release.sh" line_range="315-318" />
<code_context>
+      ((rank > last)) || die "${file}: section '${line}' is out of order"
+      ((intro)) || die "${file}: the intro paragraph must come before the sections"
+      last="${rank}" filled=0
+    elif [[ -n "${line// /}" ]]; then
+      ((last > 0)) || intro=1
+      filled=1
+    fi
+  done < <(tail -n +2 "${file}")
+  ((filled)) || die "${file}: the last section is empty"
</code_context>
<issue_to_address>
**Malformed bullets pass notes lint**

When a curated section contains nonblank text that is not a properly referenced bullet, `lint` treats any nonblank text as filling a section and does not require bullets or their issue and pull request references. Notes that omit the documented references or use prose instead of bullets therefore pass and are published in a format the release process says to reject.

Validate the section entries against the documented bullet format, including the required issue and pull request references.
</issue_to_address>

### Comment 9
<location path=".github/scripts/release.sh" line_range="306" />
<code_context>
+      filled=1
+    elif ((fenced)); then
+      filled=1
+    elif [[ "${line}" == "#"* ]]; then
+      ((filled)) || die "${file}: empty section before '${line}'"
+      [[ "${line}" == "## "* ]] || die "${file}: only sections (##) after the title: ${line}"
</code_context>
<issue_to_address>
**Indented headings pass validation**

When a curated notes file contains a Markdown heading with one to three leading spaces, `lint` checks whether the raw line starts with `#`, so it treats the heading as paragraph text and publishes a notes file containing a prohibited heading.

Recognize Markdown headings after allowing up to three leading spaces.

Also at `.github/scripts/release.sh:307`.
</issue_to_address>

### Comment 10
<location path="RELEASING.md" line_range="40" />
<code_context>
 - uses: elixir-cloud-aai/.github/actions/<name>@<40-character SHA> # vX.Y.Z
 ```

-Releases are automatic: there is nothing to do by hand. Dependabot
</code_context>
<issue_to_address>
**Release draft command fails**

When the maintainer follows the documented draft command in a checkout where `docs/releases` does not exist, the shell cannot open the output file, so the draft command never runs and the maintainer must discover that the directory needs to be created first.

Create `docs/releases` in the repository or add `mkdir -p docs/releases` before the documented command.
</issue_to_address>

### Comment 11
<location path="tests/release/test.sh" line_range="141-142" />
<code_context>
-expect_plan "${featish}" "error"
+expect_check v2.0.2 "${nothing}" "previous=v2.0.1"
+expect_in "warning without changes to the actions" "No commit since v2.0.1 changed the actions" \
+  "$(bash "${script}" check v2.0.2 "${nothing}" 2>&1 > /dev/null)"
+# A commit that is released already can't be released again
+expect_check v2.0.2 "${featish}" "error"
 git tag -d v2.0.1 > /dev/null
</code_context>
<issue_to_address>
**Unconditional warnings go unnoticed**

When `check` emits the no-action warning unconditionally, the warning assertion passes if `check` emits this warning for every release: it only checks that the warning appears for the docs-only commit, while `expect_check` discards stderr for the action-changing cases, so ordinary releases can get spurious warnings without failing the test.

Assert that the warning is absent for an action-changing commit as well as present for the docs-only commit.
</issue_to_address>

Linked issues

#30 ci: release from signed version tags · 7 of 8 met · 1 to check by hand

# Requirement Status Notes
1 Trigger releases from signed version tags, not workflow_run or a schedule. ✅ Met The workflow triggers on push of v* tags and checks that the tag is annotated and GitHub-verified.
2 Prepare checks the tag commit is on main and has a successful CI run. ✅ Met The prepare job checks ancestry against origin/main and queries for a successful push run of ci.yml for the commit.
3 Check the pushed version against the latest release and the changes that need releasing, and require release notes. ✅ Met release.sh check validates the version and release ancestry; release.sh lint checks the curated notes file.
4 Publish the release in the release environment with notes in the organization's format. ✅ Met The publish job uses the release environment and combines curated notes with GitHub-generated notes.
5 Use a release-prep PR for curated notes and retain useful release checks while removing obsolete automation. ✅ Met RELEASING.md documents the notes PR and tag steps; the script provides check, draft, lint, and release-body commands, with adapted tests.
6 Keep callers' commit pins and Dependabot updates unchanged. ✅ Met The docs retain the commit-pin workflow and explain that Dependabot still proposes pin updates.
7 Rewrite RELEASING.md and update the README release sentence. ✅ Met RELEASING.md now documents when and how to release, checks, failures, and settings; the README describes signed-tag releases.
8 Use the repository's tag rulesets and release-environment protection settings. 👀 Check by hand (external system) Check GitHub settings to confirm the v* tag rulesets, immutable releases, and required reviewers for the release environment are configured as documented.

Sourcery assessment

Needs a human reviewer. 10 findings to address first, and a tag that passes these checks can publish a release for the wrong commit or version; reverting the workflow will not remove the tag or release, and downstream repositories may adopt it through Dependabot. The required publish approval limits accidental publication, but correcting a bad release would require a later release.

Blocking findings: .github/workflows/release.yml:100, .github/workflows/release.yml:23, .github/scripts/release.sh:79, .github/workflows/release.yml:15, .github/scripts/release.sh:302, and 5 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/scripts/release.sh Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/scripts/release.sh Resolved
Comment thread .github/scripts/release.sh Resolved
Comment thread .github/scripts/release.sh Resolved
Comment thread .github/scripts/release.sh Resolved
Comment thread RELEASING.md Resolved
Comment thread tests/release/test.sh Resolved
Count only published releases, require CI on main, set latest only
for the highest version, fail on release lookup errors, reject
unclosed code blocks and indented headings in the notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 4fba5b0 into main Oct 31, 2026
5 checks passed
@uniqueg
uniqueg deleted the ci/release-from-tags branch October 31, 2026 05:18
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.

ci: release from signed version tags

1 participant