Skip to content

Commit b386966

Browse files
authored
chore: npm auth to OIDC (#639)
* use github_token instead of PAT * update npm to use latest version * add provenance feat to package.json
1 parent bc0da1e commit b386966

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,31 @@ on:
1313
jobs:
1414
ci:
1515
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write
18+
contents: write
19+
pull-requests: write
1620
if: |
1721
github.event.pull_request.head.repo.full_name == github.repository ||
1822
(github.ref == 'refs/heads/master' && github.event_name == 'push')
1923
steps:
2024
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
2125
with:
22-
token: '${{ secrets.BOT_TOKEN }}'
26+
token: '${{ secrets.GITHUB_TOKEN }}'
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js and Authenticate with npm
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '20'
33+
registry-url: 'https://registry.npmjs.org'
34+
35+
- name: Update npm to the latest version
36+
run: npm install -g npm@latest
2337

2438
- name: Build packages
2539
uses: ./.github/actions/build
2640

27-
- name: prepare npm access
28-
run: echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' >> ~/.npmrc
29-
# https://github.com/lerna/lerna/issues/2788 --no-verify-access
30-
# https://github.com/lerna/lerna/issues/1893 --preid ${{ github.sha }}
3141
- name: prerelease
3242
if: |
3343
!contains(github.head_ref, 'dependabot') &&
@@ -49,9 +59,9 @@ jobs:
4959
github.event_name == 'push' &&
5060
github.ref == 'refs/heads/master'
5161
env:
52-
GH_TOKEN: '${{ secrets.BOT_TOKEN }}'
62+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
5363
run: |
5464
git config user.name "GitHub Actions Build"
5565
git config user.email "[email protected]"
5666
yarn release:check
57-
yarn release:latest --yes --no-verify-access
67+
yarn release:latest --yes --no-verify-access --npm-publish-args="--provenance"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"commit": "git-cz",
2222
"release:check": "lerna changed",
2323
"release:latest": "lerna publish --yes --conventional-commits --create-release github --message 'chore(release): publish [ci skip]'",
24-
"release:canary": "lerna publish --canary --ignore-scripts",
24+
"release:canary": "NPM_CONFIG_PROVENANCE=true lerna publish --canary --ignore-scripts",
2525
"prepare": "husky install"
2626
},
2727
"workspaces": [

0 commit comments

Comments
 (0)