Skip to content

Commit 499a409

Browse files
committed
ci: publish canary under @canary only — leave @latest untouched (OIDC one-tag limit)
1 parent a8ff283 commit 499a409

1 file changed

Lines changed: 5 additions & 21 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,15 @@ jobs:
6969
sed -i '/_authToken/d' "$NPM_CONFIG_USERCONFIG"
7070
unset NODE_AUTH_TOKEN
7171
72-
PKG=$(node -p "require('./package.json').name")
7372
BASE_VERSION=$(node -p "require('./package.json').version")
7473
SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-7)
7574
CANARY_VERSION="${BASE_VERSION}-canary.${SHORT_SHA}"
7675
npm version "$CANARY_VERSION" --no-git-tag-version --ignore-scripts
77-
78-
# Canary dist-tags (mode-aware). OIDC is publish-only, so a follow-up `dist-tag add`
79-
# may fail — `@latest` correctness is guaranteed; advancing `@canary` is best-effort.
80-
# - No stable `latest` yet (unpublished, or current `latest` is a pre-release) -> publish
81-
# AS `latest` so a bare `npm i` always resolves the NEWEST canary; best-effort tag `@canary`.
82-
# - A stable `latest` exists -> publish under `canary` only; never clobber stable `latest`.
83-
CURRENT_LATEST=$(npm view "${PKG}@latest" version 2>/dev/null || echo "")
84-
case "$CURRENT_LATEST" in
85-
"" | *-*)
86-
npx -y npm@11 publish --tag latest --provenance --access public --ignore-scripts
87-
if npx -y npm@11 dist-tag add "${PKG}@${CANARY_VERSION}" canary; then
88-
echo "::notice title=canary tag::@canary advanced to ${CANARY_VERSION}"
89-
else
90-
echo "::warning title=canary tag::dist-tag failed — @canary needs a granular NPM_TOKEN (OIDC is publish-only); @latest is current"
91-
fi
92-
;;
93-
*)
94-
npx -y npm@11 publish --tag canary --provenance --access public --ignore-scripts
95-
;;
96-
esac
76+
# Roll the @canary channel via OIDC (no token). One OIDC publish sets exactly one
77+
# dist-tag; advancing a 2nd (e.g. @latest) would need a token — the dist-tag PUT
78+
# returns 401 under OIDC — so @latest is left untouched. Install the newest canary
79+
# with `npm i <pkg>@canary`.
80+
npx -y npm@11 publish --tag canary --provenance --access public --ignore-scripts
9781
9882
release:
9983
name: Publish Release

0 commit comments

Comments
 (0)