Skip to content

Commit e0ef3b1

Browse files
committed
fix: Separate binaries from npm dist, skip npm publish if no token
1 parent 3253ac5 commit e0ef3b1

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ jobs:
199199
- name: Download all artifacts
200200
uses: actions/download-artifact@v4
201201
with:
202-
path: binaries
202+
path: artifacts
203203

204-
- name: Prepare binaries
204+
- name: Prepare release binaries
205205
run: |
206-
mkdir -p dist
207-
find binaries -type f -exec cp {} dist/ \;
208-
ls -lh dist/
206+
mkdir -p release-binaries
207+
find artifacts -type f -exec cp {} release-binaries/ \;
208+
ls -lh release-binaries/
209209
210210
- name: Generate changelog
211211
id: changelog
@@ -298,18 +298,28 @@ jobs:
298298
name: ${{ needs.prepare.outputs.channel == 'release' && format('Release v{0}', needs.prepare.outputs.version) || format('{0} v{1}', needs.prepare.outputs.channel, needs.prepare.outputs.version) }}
299299
body: ${{ steps.changelog.outputs.changelog }}
300300
files: |
301-
dist/*
301+
release-binaries/*
302302
install.sh
303303
draft: false
304304
prerelease: ${{ needs.prepare.outputs.channel != 'release' }}
305305
env:
306306
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
307307

308-
- name: Publish to npm (release only)
308+
- name: Build JS dist for npm
309309
if: needs.prepare.outputs.channel == 'release'
310310
run: |
311-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
312-
npm publish
311+
bun install
312+
bun run build
313+
ls -lh dist/
314+
315+
- name: Publish to npm (release only)
316+
if: needs.prepare.outputs.channel == 'release'
313317
env:
314318
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
315-
continue-on-error: true
319+
run: |
320+
if [ -z "$NPM_TOKEN" ]; then
321+
echo "⚠️ NPM_TOKEN not set, skipping npm publish"
322+
exit 0
323+
fi
324+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
325+
npm publish --access public

0 commit comments

Comments
 (0)