Repository navigation
ci: release from signed version tags - #31
Conversation
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideReleases 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 workflowsequenceDiagram
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
Flow diagram for release preparation gatesflowchart 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]
Flow diagram for curated release notesflowchart 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]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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
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]>
Summary
Releases of the shared actions now come from signed
vX.Y.Ztags that the maintainer pushes, as in the other repositories (cloud-registry, proTES), instead of the automatic release after CI onmain..github/workflows/release.yml(Release): onpush: 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 onmainand that CI passed for its push. It also runsrelease.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 onmain, and it isn't released yet. Finally it runsrelease.sh linton the curated notesdocs/releases/vX.Y.Z.md.publish/ "Publish release" runs in the environmentreleaseand creates the release from the curated notes, followed by GitHub's generated notes under## Commitsand the Full Changelog line. A re-run when the release already exists is a no-op..github/scripts/release.sh:planis replaced bycheck.notesbecomesdraft, which drafts the curated notes for the release-prep PR with aTODOline that you must remove.lintandnotesare new (the release body).tests/release/test.shis adapted and extended.Callers don't change: they still pin to the commit of a
vX.Y.Ztag, and Dependabot still bumps the pins.Since review: only published releases count as previous releases, CI must have passed on
main,--latestis 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
mainno longer trigger anything, and the next release happens only when the maintainer pushes a tag. This PR changes nothing underactions/, 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 rannpx [email protected]instead: 0 issues.git/tags/<sha>,GITHUB_SHAon annotated tag pushes and--verify-tagneeds a dry run in a fork on a test tag before the first tagged release.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 lintandcheckcan be run locally before tagging.Sourcery, unvalidated tags reach callers' Dependabot before
preparepasses: 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:
Bug Fixes:
Enhancements:
CI:
Deployment:
Documentation:
Tests: