Skip to content

Commit 01d9896

Browse files
authored
Merge pull request #4 from sanity-labs/fix/oidc-release-workflow
fix(ci): use direct npm publish for OIDC provenance
2 parents f01e41e + 3ab9beb commit 01d9896

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,26 @@ jobs:
4141
- name: Test
4242
run: pnpm test:run
4343

44-
- name: Create Release Pull Request or Publish
45-
id: changesets
44+
- name: Check if version exists on npm
45+
id: check
46+
run: |
47+
CURRENT_VERSION=$(node -p "require('./package.json').version")
48+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
49+
if npm view boxfix@$CURRENT_VERSION > /dev/null 2>&1; then
50+
echo "exists=true" >> $GITHUB_OUTPUT
51+
else
52+
echo "exists=false" >> $GITHUB_OUTPUT
53+
fi
54+
55+
- name: Publish to npm
56+
if: steps.check.outputs.exists == 'false'
57+
run: npm publish --provenance --access public
58+
59+
- name: Create Release Pull Request
4660
uses: changesets/action@v1
4761
with:
48-
publish: pnpm release
4962
version: pnpm changeset version
5063
title: 'chore: version packages'
5164
commit: 'chore: version packages'
5265
env:
5366
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
NPM_CONFIG_PROVENANCE: true

0 commit comments

Comments
 (0)