Skip to content

Commit 6e6a2e5

Browse files
feat: migrate npm publishing using OIDC (#1400)
1 parent d17934d commit 6e6a2e5

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

.github/actions/npm-publish/action.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Publish release to npm
22

33
inputs:
4-
npm-token:
5-
required: true
64
version:
75
required: true
86
release-directory:
@@ -22,14 +20,6 @@ runs:
2220
shell: bash
2321
run: yarn ci
2422

25-
- name: Verify npm token
26-
shell: bash
27-
run: |
28-
if [ -z "${{ inputs.npm-token }}" ]; then
29-
echo "Error: npm-token is not provided."
30-
exit 1
31-
fi
32-
3323
- name: Publish release to NPM
3424
shell: bash
3525
working-directory: ${{ inputs.release-directory }}
@@ -43,5 +33,4 @@ runs:
4333
fi
4434
npm publish --provenance --tag $TAG
4535
env:
46-
NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
4736
VERSION: ${{ inputs.version }}

.github/workflows/npm-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ on:
99
secrets:
1010
github-token:
1111
required: true
12-
npm-token:
13-
required: true
1412

1513
jobs:
1614
release:
1715
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
1816
runs-on: ubuntu-latest
1917
environment: release
18+
permissions:
19+
contents: write
20+
id-token: write
2021

2122
steps:
2223
# Checkout the code
@@ -58,7 +59,6 @@ jobs:
5859
- uses: ./.github/actions/npm-publish
5960
with:
6061
version: ${{ steps.get_version.outputs.version }}
61-
npm-token: ${{ secrets.npm-token }}
6262
release-directory: ${{ inputs.release-directory }}
6363

6464
# Create a release for the tag

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
release:
2020
uses: ./.github/workflows/npm-release.yml
2121
secrets:
22-
npm-token: ${{ secrets.NPM_TOKEN }}
2322
github-token: ${{ secrets.GITHUB_TOKEN }}
2423

2524
publish-docs:

0 commit comments

Comments
 (0)