From 47f04cd2ceb79bab35fd25f2031d3b42cd6f6b2c Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 17 Apr 2026 14:43:49 +0100 Subject: [PATCH] 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) --- .github/workflows/npmpublish.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 5b0abc9..1680e85 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -63,8 +63,16 @@ jobs: # `pnpm version patch` bumps package.json, makes a commit, and creates # a `v` tag. Capture the new tag name from package.json # rather than parsing pnpm's output, which has historically varied. - pnpm version patch - NEW_TAG="v$(node -p "require('./package.json').version")" + # Bump the patch component directly with Node. pnpm/action-setup@v6 + # sometimes installs pnpm 11 pre-releases even when version: 10.x is + # requested (pnpm/action-setup#225); those pre-releases either skip + # the git commit/tag or reject --no-git-tag-version as unknown. + # Doing the bump in Node sidesteps both failure modes. + 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);") + NEW_TAG="v${NEW_VERSION}" + git add package.json + git commit -m "${NEW_TAG}" + git tag -a "${NEW_TAG}" -m "${NEW_TAG}" # CRITICAL: use --atomic so the branch update and the tag update # succeed (or fail) as a single transaction on the server. The old # `git push --follow-tags` was non-atomic per ref: if a concurrent