Skip to content

Commit f998d44

Browse files
authored
ci: switch to npm's trusted publishing, split release into a separate job (#55)
1 parent ae2710e commit f998d44

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: CI
2-
on: [push]
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request: {}
7+
38
jobs:
49
build:
510
runs-on: ubuntu-latest
@@ -23,12 +28,33 @@ jobs:
2328
run: |
2429
npm run ci
2530
31+
release:
32+
needs: [build]
33+
runs-on: ubuntu-latest
34+
if: success() && github.ref == 'refs/heads/main'
35+
permissions:
36+
id-token: write
37+
environment:
38+
name: npm
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Node 22
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 22.x
47+
48+
- name: Install dependencies
49+
run: |
50+
npm install -g npm@latest
51+
npm install
52+
npm install --workspaces
53+
2654
- name: Release
2755
id: changesets
28-
if: github.ref == 'refs/heads/main'
2956
uses: changesets/action@v1
3057
with:
3158
publish: npm run release
3259
env:
3360
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)