Skip to content

ci: align the release workflow - #517

Merged
uniqueg merged 5 commits into
devfrom
ci/align-release-workflow
Oct 30, 2026
Merged

uniqueg merged 5 commits into
devfrom
ci/align-release-workflow

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Aligns the release workflow with the org's release workflows (cloud-registry, proTES) and adds citation metadata.

  • Jobs: prepare / "Prepare release" holds all checks and the other jobs need it: tag and versions (root, released packages, CITATION.cff), tag on dev, a successful CI run for a push of the tagged commit (new, as in cloud-registry), and lint (formerly the separate lint job; still never in the job with id-token: write). npm / "Release packages" (formerly publish) stages the packages on npm. publish / "Publish release" (formerly github / "Release on GitHub") creates the GitHub release. Names are unique across the repo's workflows.
  • CITATION.cff: new, modelled on cloud-registry's. Authors: people with at least 100 lines committed to main (no bots, lock files, images), ordered by lines. node scripts/release.js set <version> [--date YYYY-MM-DD] now also sets version and date-released; check also fails unless they match the release (date not in the future, UTC). set checks everything before it changes anything and can be run again for the same version. CI validates the file with cffconvert --validate (as cloud-registry).
  • Environment: stays npm. npm's trusted publishers bind the environment name, so the switch to release (org decision) is a one-line change made together with the maintainer's rename of the environment and the 9 trusted publishers.
  • Docs: "Releases" in CONTRIBUTING.md describes the jobs and the new checks; a new "Citation metadata" section explains authorship and how to correct an entry.

Closes #514

Verification

  • node --test scripts/release.test.js: 25 pass, 0 fail (new tests for the citation checks, set incl. a real npm version in a fixture, the date option, CRLF and continuation edge cases).
  • npm run lint (all workspaces, includes the build): passes.
  • npx eslint / prettier --check on scripts/: clean.
  • actionlint (with shellcheck) on all workflows: no findings.
  • cffconvert --validate -i CITATION.cff (2.0.0): valid.
  • Local release dry run against the branch: release.js check 2.0.0-alpha.49 passes; check 2.0.0-alpha.50 fails listing all manifests and CITATION.cff; dist-tag 2.0.0-alpha.49 gives latest; set 2.0.0-alpha.50 followed by check 2.0.0-alpha.50 passes (reverted afterwards); set with a future or malformed date, or a stray option, exits 1 without changes.
  • Fork dry run in uniqueg/cloud-components (branch dev there = this branch, test tags only in the fork):
    • v2.0.0-alpha.49 on this branch's head after the fork's CI passed (run): all three jobs passed; "Prepare release" passed every check (dist-tag latest); "Release packages" skipped all 9 packages as already on npm; "Publish release" created the fork's release.
    • v2.0.0-alpha.50 on a version bump made with release.js set 2.0.0-alpha.50 (run): tagged before CI finished, "Prepare release" failed with "No successful run of the CI workflow (ci.yml) for a push of 3ec1463…; once CI passed for it, re-run this workflow"; after CI passed, "Re-run failed jobs" passed all three jobs, dry-run staging of all 9 packages with --provenance --tag latest, release created in the fork.
    • Not covered: OIDC exchange with npm, real staging and the approval in the npm environment (the fork's run didn't wait for one); the upstream rulesets.
  • CI: all checks green (CI passed, PR title, CodeQL, Read the Docs).

Declined review findings

  • Document the manual cffconvert pin in CONTRIBUTING.md (quality, low): the workflow comment states it, as in cloud-registry.
  • The test that checks this repository's own package.json against CITATION.cff couples the test to repository state (quality, low): intended, so that a version bump that misses CITATION.cff fails CI.
  • Date and version validation repeated in a few helpers (quality, low): each throws a context-specific message; a shared helper would save little.
  • Make set transactional and serialize concurrent runs (Sourcery): a manual step in a git working tree, recoverable with git checkout or a re-run; CI and the release check catch any mismatch (replies in the threads).

🤖 Generated with Claude Code

Summary by Sourcery

Align the release process with organization workflows while adding validated citation metadata to releases.

New Features:

  • Add citation metadata in CITATION.cff for GitHub and Zenodo use.
  • Extend release version tooling to maintain and validate citation version and release-date metadata.

Enhancements:

  • Align the release workflow around preparation, npm staging, and GitHub publication jobs, including verification that CI passed for the tagged commit.
  • Document the updated release process and how contributors can maintain citation metadata.

CI:

  • Validate CITATION.cff during CI with cffconvert.
  • Expand release-script tests to cover citation validation, date handling, formatting edge cases, and version updates.

Documentation:

  • Document release job responsibilities, citation authorship, and correction procedures in CONTRIBUTING.md.

uniqueg and others added 4 commits October 30, 2026 14:47
Add CITATION.cff, which GitHub and Zenodo read, with the authors who
committed at least 100 lines to main. `node scripts/release.js set`
now also sets its version and release date, and `check` fails unless
its version is the release version and its date is not in the future
(UTC). CI validates the file with cffconvert.

Refs #514

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Align the jobs with the org's release workflows (cloud-registry,
proTES): `prepare` ("Prepare release") holds all checks and now also
lints, checks the citation metadata and requires a successful CI run
for a push of the tagged commit; `npm` ("Release packages") stages the
packages; `publish` ("Publish release") creates the GitHub release.
The `npm` environment keeps its name until the maintainer renames it
together with the npm trusted publishers. Document the jobs and the
citation metadata in CONTRIBUTING.md.

Closes #514

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`set` now checks the version, the date and CITATION.cff before it runs
`npm version`, so that a bad citation file leaves nothing half-updated.
The citation checks also reject values continued after blank lines or
with CRLF line endings, and keep CRLF endings when setting values.
Test the release date option.

Refs #514

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move `set` into `setRelease`, with the package version bump injectable,
and test that it checks the version, the date and CITATION.cff before
it changes anything. Allow `set` to run again for the same version,
keep comments and CRLF endings in CITATION.cff, and reject keys without
a space after the colon.

Refs #514

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

sourcery-ai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Aligns release automation with the organization’s gated workflow pattern by centralizing readiness checks, requiring successful CI for the tagged commit, and separating npm staging from GitHub publication. It also introduces validated CITATION.cff metadata and extends the release script to manage citation version and UTC release-date fields safely, with comprehensive tests and updated contributor documentation.

Sequence diagram for the gated release workflow

sequenceDiagram
    actor Maintainer
    participant GitHubActions
    participant Prepare
    participant CI
    participant NPM
    participant GitHubRelease

    Maintainer->>GitHubActions: Push v<version> tag on dev
    GitHubActions->>Prepare: Run Prepare release
    Prepare->>CI: Check successful push run for tagged commit
    CI-->>Prepare: CI passed
    Prepare->>Prepare: Check versions, tag branch, citation metadata, and npm run lint
    Prepare-->>GitHubActions: Readiness passed
    GitHubActions->>NPM: Run Release packages
    NPM-->>Maintainer: Request npm environment approval
    Maintainer->>NPM: Approve deployment
    NPM->>NPM: Stage packages with trusted publishing
    NPM-->>GitHubActions: Staging completed
    GitHubActions->>GitHubRelease: Run Publish release
    GitHubRelease-->>Maintainer: Create GitHub release
Loading

Flow diagram for citation metadata release management

flowchart TD
    A[Run release.js set <version>]
    B[Validate version and optional UTC date]
    C[Validate CITATION.cff before changes]
    D[Update package versions]
    E[Set citation version and date-released]
    F[CI runs cffconvert validation]
    G[Release prepare runs release.js check]
    H{Metadata matches release and date is not future?}
    I[Release checks pass]
    J[Release checks fail]

    A --> B
    B --> C
    C --> D
    D --> E
    E --> F
    F --> G
    G --> H
    H -->|Yes| I
    H -->|No| J
Loading

File-Level Changes

Change Details Files
Reorganized the release workflow into a gated preparation stage followed by npm staging and GitHub publication, adding a successful push-triggered CI prerequisite and preserving the npm trusted-publishing boundary.
  • Centralized version, tag, branch, CI-run, and lint checks in prepare.
  • Renamed and chained the package staging and GitHub release jobs as npm and publish.
  • Added timeouts, least-privilege permissions, and documentation for the revised release sequence.
.github/workflows/release.yml
CONTRIBUTING.md
Added citation metadata as a release artifact and integrated its validation into CI and release readiness checks.
  • Added CITATION.cff with contributor authorship metadata.
  • Validated the file with pinned cffconvert in CI.
  • Documented citation authorship, corrections, and release handling.
CITATION.cff
.github/workflows/ci.yml
CONTRIBUTING.md
Extended the release utility to update and validate citation version and release-date fields alongside package versions.
  • Added UTC date parsing, future-date validation, and citation key validation.
  • Made set update citation fields atomically after preflight checks, support --date, preserve formatting/comments, and allow repeated same-version runs.
  • Made check report package and citation mismatches, including malformed, missing, duplicate, or continued YAML values.
scripts/release.js
Expanded release-script coverage for citation metadata parsing, date handling, formatting preservation, atomic updates, and CLI integration.
  • Added tests for valid and invalid citation fields, CRLF and continuation edge cases, missing or duplicate keys, and future dates.
  • Added tests verifying no files change when preflight validation fails and that successful updates preserve unrelated content.
scripts/release.test.js

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 30, 2026 15:05
@uniqueg
uniqueg requested a review from anuragxxd as a code owner October 30, 2026 15:05

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 3 issues

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

## Individual Comments

### Comment 1
<location path="scripts/release.js" line_range="344-345" />
<code_context>
+  parseVersion(version);
+  const date = releaseDate(options, now);
+  const citation = citationWithRelease(version, date, base);
+  bumpVersions(version);
+  fs.writeFileSync(path.join(base, citationFile), citation);
+  return date;
+};
</code_context>
<issue_to_address>
**Release metadata becomes inconsistent**

When the process is interrupted or the citation write fails after `bumpVersions` succeeds, `setRelease` has updated the package manifests and lock file; interruption leaves the old `CITATION.cff`, while a failed `fs.writeFileSync` can leave it truncated, so `check` rejects the repository.

Make the manifest, lock-file, and citation updates a recoverable transaction so interruption or a write error leaves either all old or all new files.
</issue_to_address>

### Comment 2
<location path="scripts/release.js" line_range="344-345" />
<code_context>
+  parseVersion(version);
+  const date = releaseDate(options, now);
+  const citation = citationWithRelease(version, date, base);
+  bumpVersions(version);
+  fs.writeFileSync(path.join(base, citationFile), citation);
+  return date;
+};
</code_context>
<issue_to_address>
**Concurrent bumps mismatch release metadata**

When two `set` commands target different versions in the same working tree at once, both invocations calculate their citation text before changing files, then update package versions and write `CITATION.cff` without serialization. If the writes complete in a different order from the version bumps, the manifests and citation file end up with different versions, and `check` rejects the release.

Serialize the entire `setRelease` operation for a working tree, or stage and apply each invocation’s changes as one guarded operation.
</issue_to_address>

### Comment 3
<location path="scripts/release.test.js" line_range="413" />
<code_context>
+  const date = setRelease("2.0.0-alpha.50", [], {
+    base,
+    now: today,
+    bumpVersions: (version) => bumped.push(version),
+  });
+  assert.strictEqual(date, "2026-10-30");
</code_context>
<issue_to_address>
**Package version updates go untested**

When the default package-version updater is omitted or broken, the `setRelease bumps the versions and sets the citation` test injects a spy at `scripts/release.test.js:410-414` and only checks that it was called at line 416. The actual `set` command can leave package manifests unchanged while this test remains green.

Exercise the real default updater through `set` in an isolated repository fixture, and assert the package manifests’ versions change.
</issue_to_address>

Linked issues

#514 ci: align the release workflow · 5 of 6 met · 1 to check by hand

# Requirement Status Notes
1 A prepare job named "Prepare release" holds all checks, and the other jobs need it. ✅ Met The job checks the versions, tag branch, successful CI run, and lint; npm needs prepare, and publish needs npm.
2 Jobs that publish to a registry are named after what they release and are unique across the repo's workflows. ✅ Met The registry job is named "Release packages"; that name is unique among the repository's workflow job names.
3 publish / "Publish release" creates the GitHub release. ✅ Met The publish job is named "Publish release" and creates the release with gh release create.
4 Use the release environment for publishing once the maintainer has renamed the environment and npm trusted publishers. 👀 Check by hand (external system) Check whether the GitHub environment and npm trusted-publisher bindings have been renamed to release; the workflow still references npm and would need to change jointly if that rename is complete.
5 Required checks remain unaffected, with only CI passed required. ✅ Met The CI workflow still has the CI passed gate that requires all its jobs to pass.
6 Add CITATION.cff and check it in prepare. ✅ Met prepare runs the release script's citation version and date checks, and CI validates the file with cffconvert.

Sourcery assessment

Needs a human reviewer. 3 findings to address first, and a bad citation version or release date could be captured in a Zenodo archive when a later release is made; correcting that historical metadata is bounded but may require updating the archive. The new CI check can also block releases if its GitHub Actions query fails, but reverting restores the previous release path.

Blocking findings: scripts/release.js:345, scripts/release.js:345, scripts/release.test.js:413


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

Comment thread scripts/release.js Resolved
Comment thread scripts/release.js Resolved
Comment thread scripts/release.test.js Resolved
`setVersion` takes the repository directory, so that a test runs the
real `npm version` through `setRelease` in a fixture repository and
checks the versions of the root and the released packages.

Refs #514

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit abf6fff into dev Oct 30, 2026
16 of 18 checks passed
@uniqueg
uniqueg deleted the ci/align-release-workflow branch October 30, 2026 18:13
@uniqueg uniqueg mentioned this pull request Nov 1, 2026
3 tasks
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: align the release workflow

1 participant