ci: publish to JSR from a dated tag, and close the changelogs #9

Merged
chrnx merged 2 commits from ci/release-to-jsr into develop 2026-09-23 17:35:34 +00:00
2 changed files with 29 additions and 1 deletions
Showing only changes of commit d5e8c8a827 - Show all commits

No files matched your search

+14 -1
View File
@@ -64,8 +64,21 @@ jobs:
# No token: OIDC exchanges the workflow's id-token, which is also what attaches provenance.
# `tee` because the release body is built from what this actually did rather than from a guess
# about what it would do.
#
# Two details in this one line, both of which produce a *silently wrong* release when missed:
#
# `shell: bash` — the default shell here is `bash -e`, without `pipefail`, so a pipeline
# reports the exit status of its LAST command. That is `tee`, which always
# succeeds. A failed publish would have been reported as a green step, and
# a GitHub release created for it. Naming the shell gets `-eo pipefail`.
#
# `2>&1` — deno's logger is env_logger, whose default target is stderr, so every
# "Successfully published" line goes there. Measured: a publish writes 0
# lines to stdout and all of them to stderr. Without this the log is empty
# and the release notes say nothing shipped while three packages did.
- name: Publish
run: deno publish | tee /tmp/publish.log
shell: bash
run: deno publish 2>&1 | tee /tmp/publish.log
- name: Release notes
run: node scripts/release.mjs --notes /tmp/publish.log "$GITHUB_REF_NAME" > /tmp/notes.md
+15
View File
@@ -96,6 +96,21 @@ function notes(logPath, tag) {
const shipped = [...plain.matchAll(/Successfully published (@[^@\s]+\/[^@\s]+)@(\S+)/g)]
.map(([, name, version]) => ({ name, version }));
// A log carrying neither marker is not "nothing was published" — it is a log this script cannot
// read, and the two are indistinguishable from the text alone. Saying nothing shipped when three
// packages did is the worse failure, and it is silent, so refuse instead of guessing.
//
// This is not hypothetical: the first version of this workflow piped only stdout, while deno logs
// to stderr, so every successful release would have produced an empty log and a release body
// announcing that nothing happened.
if (shipped.length === 0 && !/already published/.test(plain)) {
throw new Error(
`${logPath} contains neither "Successfully published" nor "already published". ` +
'Either the publish did not run, or its output is not being captured — check that the step ' +
'redirects stderr (deno logs there) and that the pipeline uses pipefail.',
);
}
if (shipped.length === 0) {
return `No package versions were published by \`${tag}\` — every version in the workspace was already on JSR.`;
}