Skip to content

Commit ec0b48b

Browse files
committed
chore: skip npm publish with warning when NPM_TOKEN is not set
1 parent 99f85d5 commit ec0b48b

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,22 @@ jobs:
162162
if: steps.should_release.outputs.needed == 'true'
163163
run: npm run build
164164

165-
# - name: Publish to npm
166-
# if: steps.should_release.outputs.needed == 'true'
167-
# env:
168-
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
169-
# run: |
170-
# NPM_TAG="latest"
171-
# if [ "${{ steps.prerelease.outputs.value }}" = "true" ]; then
172-
# NPM_TAG="next"
173-
# fi
174-
#
175-
# npm publish --ignore-scripts --tag "$NPM_TAG"
165+
- name: Publish to npm
166+
if: steps.should_release.outputs.needed == 'true'
167+
env:
168+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
169+
run: |
170+
if [ -z "$NODE_AUTH_TOKEN" ]; then
171+
echo "::warning::NPM_TOKEN secret is not set — skipping npm publish"
172+
exit 0
173+
fi
174+
175+
NPM_TAG="latest"
176+
if [ "${{ steps.prerelease.outputs.value }}" = "true" ]; then
177+
NPM_TAG="next"
178+
fi
179+
180+
npm publish --ignore-scripts --tag "$NPM_TAG"
176181
177182
- name: Summary
178183
if: steps.should_release.outputs.needed == 'true'

0 commit comments

Comments
 (0)