Skip to content

Commit 1ffedea

Browse files
masseaterclaude
andcommitted
fix(ci): replace npm with bun for release workflow
npm cannot handle workspace:* protocol used in monorepo dependencies, causing EUNSUPPORTEDPROTOCOL errors during version bump and publish. - Bump version via node script instead of npm version - Switch from npm publish to bun publish (auto-resolves workspace:*) - Remove unnecessary setup-node step Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0c40425 commit 1ffedea

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

.github/workflows/publish-package.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,33 @@ jobs:
6565
- name: Bump version
6666
id: version
6767
working-directory: ${{ steps.workspace.outputs.dir }}
68+
env:
69+
VERSION_TYPE: ${{ inputs.version_type }}
6870
run: |
69-
npm version ${{ inputs.version_type }} --no-git-tag-version
71+
node -e "
72+
const fs = require('fs');
73+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
74+
const [major, minor, patch] = pkg.version.split('.').map(Number);
75+
const type = process.env.VERSION_TYPE;
76+
if (type === 'major') pkg.version = \`\${major+1}.0.0\`;
77+
else if (type === 'minor') pkg.version = \`\${major}.\${minor+1}.0\`;
78+
else pkg.version = \`\${major}.\${minor}.\${patch+1}\`;
79+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
80+
"
7081
NEW_VERSION=$(node -p "require('./package.json').version")
7182
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
7283
7384
- name: Build package
7485
working-directory: ${{ steps.workspace.outputs.dir }}
7586
run: bun run build
7687

77-
- name: Setup Node.js for npm publish
78-
uses: actions/setup-node@v4
79-
with:
80-
node-version: "24"
81-
registry-url: "https://registry.npmjs.org"
82-
8388
- name: Publish to npm
8489
working-directory: ${{ steps.workspace.outputs.dir }}
85-
run: npm publish --access public
90+
run: |
91+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
92+
bun publish --access public
8693
env:
87-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
94+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8895

8996
- name: Commit and tag
9097
run: |

0 commit comments

Comments
 (0)