Skip to content

Commit ed27e97

Browse files
authored
Update npm publishing to use OIDC authentication (#164)
Signed-off-by: Fern Support <[email protected]>
1 parent b0f476b commit ed27e97

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/npm-publish-cloud.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
1+
# This workflow will run tests using node and then publish a package to npm when a release is created
22
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3-
43
name: publish-cloud-to-npm
5-
64
on:
75
release:
86
types: [published]
97
jobs:
108
build:
119
if: github.event.release.target_commitish == 'main'
1210
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
1313
steps:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-node@v4
1616
with:
17-
node-version: '18.x'
18-
registry-url: 'https://registry.npmjs.org'
17+
node-version: '18.18.0'
18+
- name: Setup yarn
19+
run: npm install -g yarn
1920
- name: Compare package.json version with tag
2021
run: |
2122
TAG_VERSION=${GITHUB_REF#refs/tags/}
@@ -39,10 +40,11 @@ jobs:
3940
run: yarn install --frozen-lockfile
4041
- name: Publish package
4142
run: |
43+
publish() {
44+
npx -y npm@latest publish "$@"
45+
}
4246
if [ "$is_next" = "true" ]; then
43-
yarn publish --tag preview
47+
publish --tag preview
4448
else
45-
yarn publish
49+
publish
4650
fi
47-
env:
48-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)