Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions .github/workflows/release-vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,24 @@
# Publish the packed tarball rather than the directory: the committed
# package.json carries the placeholder version 0.0.0 and no binary, so a bare
# `npm publish` in a package directory would burn the name on an empty 0.0.0.
# Provenance is omitted from the manual step (it needs a CI OIDC identity);
# register the trusted publisher afterwards and every later publish gets it.
# Provenance is omitted from the manual step (it needs a CI OIDC identity).
#
# THEN REGISTER THE TRUSTED PUBLISHER. This is not optional: the publish job
# below holds no npm token, only an OIDC identity, so until the package names
# this workflow as a trusted publisher every CI publish of it fails. On
# npmjs.com, the package's Settings -> Trusted Publisher -> GitHub Actions:
#
# Organization or user: taskless
# Repository: cli
# Workflow filename: release-vale.yml
# Environment name: npm-autopublish
#
# Skipping it fails late and quietly. @taskless/vale-grammars was bootstrapped
# by hand on 2026-11-20 without this step, and the first release that included
# it (3.28.1, run 46330880954) published the six platform packages and got a
# 404 on the seventh. The set was left at two versions, and the downstream
# upgrade detector refused to read it, which is correct but says nothing about
# the cause. The publish step now names it (see the 404 handling there).
#
# Action refs are pinned to commit SHAs; the trailing comment records the tag.

Expand Down Expand Up @@ -446,10 +462,21 @@ jobs:
name="$(tar -xzOf "$tarball" package/package.json | node -e 'let raw = ""; process.stdin.on("data", (chunk) => { raw += chunk; }).on("end", () => { console.log(JSON.parse(raw).name); });')"
if npm view "${name}@${STAMPED_VERSION}" version >/dev/null 2>&1; then
echo "${name}@${STAMPED_VERSION} is already published — skipping."
elif ! npm publish --provenance --access public --tag latest "./$tarball"; then
elif npm publish --provenance --access public --tag latest "./$tarball" >publish.log 2>&1; then
cat publish.log
else
cat publish.log
echo "::error::failed to publish ${name}@${STAMPED_VERSION}"
# With no token configured, a package that does not list this
# workflow as a trusted publisher gets no OIDC credential, and
# npm reports the anonymous PUT as a 404 on a name that plainly
# exists. Say so, because the 404 reads like a typo.
if grep -q 'E404' publish.log && npm view "${name}" name >/dev/null 2>&1; then
echo "::error::${name} exists on npm but rejected this publish with a 404: it most likely has no trusted publisher for taskless/cli release-vale.yml (environment npm-autopublish). Register one; the bootstrap notes at the top of release-vale.yml list the fields."
fi
failed+=("$name")
fi
rm -f publish.log
echo "::endgroup::"
done

Expand Down
Loading