Skip to content

Commit 5abb3da

Browse files
committed
fix npm token issue while publishing
1 parent 933bd95 commit 5abb3da

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/manual-publish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,14 @@ jobs:
112112
echo "NPM tag: ${{ github.event.inputs.npm_tag }}"
113113
echo "Dry run: ${{ github.event.inputs.dry_run }}"
114114
115+
# Workaround: bun publish looks for .npmrc in $XDG_CONFIG_HOME, not $HOME
116+
# https://github.com/oven-sh/bun/issues/24124
115117
- name: Publish to NPM
116118
working-directory: ${{ env.CLI_PACKAGE_DIR }}
117119
env:
118-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
120+
XDG_CONFIG_HOME: ${{ runner.temp }}
119121
run: |
120-
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
121-
bun publish --tag ${{ github.event.inputs.npm_tag }} ${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}
122+
bun publish --verbose --access public --tag ${{ github.event.inputs.npm_tag }} ${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}
122123
123124
- name: Create Git tag
124125
if: github.event.inputs.dry_run == 'false'

.github/workflows/preview-publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,14 @@ jobs:
117117
118118
echo "✅ Safety check passed. Package name is safe to publish."
119119
120+
# Workaround: bun publish looks for .npmrc in $XDG_CONFIG_HOME, not $HOME
121+
# https://github.com/oven-sh/bun/issues/24124
120122
- name: Publish preview package
121123
env:
122124
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
125+
XDG_CONFIG_HOME: ${{ runner.temp }}
123126
run: |
124-
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
125-
if bun publish --tag preview; then
127+
if bun publish --verbose --access public --tag preview; then
126128
echo "✅ Package published successfully"
127129
else
128130
echo "❌ Package publish failed"

0 commit comments

Comments
 (0)