Repository navigation
ci: align the release workflow - #517
Conversation
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]>
Reviewer's GuideAligns 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 Sequence diagram for the gated release workflowsequenceDiagram
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
Flow diagram for citation metadata release managementflowchart 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
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 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
`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]>
Summary
Aligns the release workflow with the org's release workflows (cloud-registry, proTES) and adds citation metadata.
prepare/ "Prepare release" holds all checks and the other jobs need it: tag and versions (root, released packages,CITATION.cff), tag ondev, a successfulCIrun for a push of the tagged commit (new, as in cloud-registry), and lint (formerly the separatelintjob; still never in the job withid-token: write).npm/ "Release packages" (formerlypublish) stages the packages on npm.publish/ "Publish release" (formerlygithub/ "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 tomain(no bots, lock files, images), ordered by lines.node scripts/release.js set <version> [--date YYYY-MM-DD]now also setsversionanddate-released;checkalso fails unless they match the release (date not in the future, UTC).setchecks everything before it changes anything and can be run again for the same version. CI validates the file withcffconvert --validate(as cloud-registry).npm. npm's trusted publishers bind the environment name, so the switch torelease(org decision) is a one-line change made together with the maintainer's rename of the environment and the 9 trusted publishers.CONTRIBUTING.mddescribes 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,setincl. a realnpm versionin a fixture, the date option, CRLF and continuation edge cases).npm run lint(all workspaces, includes the build): passes.npx eslint/prettier --checkonscripts/: clean.actionlint(with shellcheck) on all workflows: no findings.cffconvert --validate -i CITATION.cff(2.0.0): valid.release.js check 2.0.0-alpha.49passes;check 2.0.0-alpha.50fails listing all manifests andCITATION.cff;dist-tag 2.0.0-alpha.49giveslatest;set 2.0.0-alpha.50followed bycheck 2.0.0-alpha.50passes (reverted afterwards);setwith a future or malformed date, or a stray option, exits 1 without changes.uniqueg/cloud-components(branchdevthere = this branch, test tags only in the fork):v2.0.0-alpha.49on this branch's head after the fork's CI passed (run): all three jobs passed; "Prepare release" passed every check (dist-taglatest); "Release packages" skipped all 9 packages as already on npm; "Publish release" created the fork's release.v2.0.0-alpha.50on a version bump made withrelease.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.npmenvironment (the fork's run didn't wait for one); the upstream rulesets.CI passed,PR title, CodeQL, Read the Docs).Declined review findings
cffconvertpin inCONTRIBUTING.md(quality, low): the workflow comment states it, as in cloud-registry.package.jsonagainstCITATION.cffcouples the test to repository state (quality, low): intended, so that a version bump that missesCITATION.cfffails CI.settransactional and serialize concurrent runs (Sourcery): a manual step in a git working tree, recoverable withgit checkoutor a re-run; CI and the releasecheckcatch 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:
CITATION.cfffor GitHub and Zenodo use.Enhancements:
CI:
CITATION.cffduring CI withcffconvert.Documentation:
CONTRIBUTING.md.