Skip to content

Commit ea67009

Browse files
committed
fix(publish): grant release perms to publish-napi, push only new tag
- publish.yml: add contents:write permission and GITHUB_TOKEN env to the publish-napi job so 'napi prepublish' can create the GitHub release (previously failed with 401 unauthorized). - publish-version.sh: push only the new v${VERSION} tag instead of --tags, avoiding rejection from stale local tags that diverge from remote.
1 parent da56f82 commit ea67009

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ jobs:
199199
publish-napi:
200200
needs: build-napi
201201
runs-on: ubuntu-latest
202+
permissions:
203+
contents: write
204+
id-token: write
202205
defaults:
203206
run:
204207
working-directory: float-pigment-css-napi
@@ -247,6 +250,8 @@ jobs:
247250
run: pnpm run artifacts
248251

249252
- name: Publish
253+
env:
254+
GITHUB_TOKEN: ${{ github.token }}
250255
run: |
251256
npm config set provenance true
252257
npm publish --access public

publish-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ if [ -z "$(git status --porcelain)" ]; then
126126
fi
127127

128128
# push to origin
129-
if git push && git push --tags; then
129+
if git push && git push origin "v${VERSION}"; then
130130
echo 'Git tag pushed.'
131131
else
132132
echo 'Git tag push failed! Abort.'

0 commit comments

Comments
 (0)