Skip to content

Commit d906520

Browse files
committed
Setup OIDC auth for npm publishing.
1 parent 86e22ab commit d906520

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/canary.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ name: Canary Release
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, ci-wip2]
66

77
jobs:
88
canary-release:
99
runs-on: ubuntu-latest
1010
if: ${{ !contains(github.event.head_commit.message, '[skip release]') }}
11-
11+
permissions:
12+
id-token: write
13+
contents: read
1214
steps:
1315
- name: Checkout code
1416
uses: actions/checkout@v4
@@ -44,16 +46,18 @@ jobs:
4446
- name: Update package.json version
4547
run: |
4648
bun --bun -e "
47-
const pkg = require('./package.json');
48-
pkg.version = '${{ steps.version.outputs.canary_version }}';
49-
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
49+
const pkg = require('./package.json');
50+
pkg.version = '${{ steps.version.outputs.canary_version }}';
51+
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));
5052
"
5153
52-
- name: Setup NPM authentication
53-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
54+
- uses: actions/setup-node@v4
55+
with:
56+
node-version: "20"
57+
registry-url: "https://registry.npmjs.org"
58+
59+
- name: Update npm
60+
run: npm install -g npm@latest
5461

5562
- name: Publish canary release
56-
run: |
57-
npm publish --tag canary --access public
58-
env:
59-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
run: npm publish --tag canary --access public

0 commit comments

Comments
 (0)