Skip to content

Commit 103365e

Browse files
JohnMcLearclaude
andcommitted
ci: bump version via Node instead of pnpm version patch
pnpm/action-setup@v6 installs varying pnpm pre-release channels (see pnpm/action-setup#225), and some of them: * silently skip the git commit + tag (caused `src refspec vX.Y.Z does not match any` publish failures) * reject `--no-git-tag-version` / `--no-commit-hooks` as unknown options Stop using `pnpm version` for the patch bump. Read/write package.json with Node, then `git add / git commit / git tag -a` ourselves. Works regardless of which pnpm variant action-setup picks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3b6ed07 commit 103365e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/npmpublish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,16 @@ jobs:
6363
# `pnpm version patch` bumps package.json, makes a commit, and creates
6464
# a `v<new-version>` tag. Capture the new tag name from package.json
6565
# rather than parsing pnpm's output, which has historically varied.
66-
pnpm version patch
67-
NEW_TAG="v$(node -p "require('./package.json').version")"
66+
# Bump the patch component directly with Node. pnpm/action-setup@v6
67+
# sometimes installs pnpm 11 pre-releases even when version: 10.x is
68+
# requested (pnpm/action-setup#225); those pre-releases either skip
69+
# the git commit/tag or reject --no-git-tag-version as unknown.
70+
# Doing the bump in Node sidesteps both failure modes.
71+
NEW_VERSION=$(node -e "const fs=require('fs');const p=require('./package.json');const v=p.version.split('.');v[2]=String(Number(v[2])+1);p.version=v.join('.');fs.writeFileSync('./package.json',JSON.stringify(p,null,2)+'\n');console.log(p.version);")
72+
NEW_TAG="v${NEW_VERSION}"
73+
git add package.json
74+
git commit -m "${NEW_TAG}"
75+
git tag -a "${NEW_TAG}" -m "${NEW_TAG}"
6876
# CRITICAL: use --atomic so the branch update and the tag update
6977
# succeed (or fail) as a single transaction on the server. The old
7078
# `git push --follow-tags` was non-atomic per ref: if a concurrent

0 commit comments

Comments
 (0)