File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Setup pnpm
2+ description : pnpm 9, Node (configurable), and frozen lockfile install — run actions/checkout before this action
3+
4+ inputs :
5+ node-version :
6+ description : Node.js version (default 22; Trusted Publishing on npm requires >= 22.14.0)
7+ required : false
8+ default : ' 22'
9+ registry-url :
10+ description : Optional npm registry URL (e.g. https://registry.npmjs.org for publishing)
11+ required : false
12+ default : ' '
13+
14+ runs :
15+ using : composite
16+ steps :
17+ - uses : pnpm/action-setup@v4
18+ with :
19+ version : 9
20+
21+ - name : Setup Node.js
22+ if : ${{ inputs.registry-url == '' }}
23+ uses : actions/setup-node@v4
24+ with :
25+ node-version : ${{ inputs.node-version }}
26+ cache : pnpm
27+
28+ - name : Setup Node.js (npm registry)
29+ if : ${{ inputs.registry-url != '' }}
30+ uses : actions/setup-node@v4
31+ with :
32+ node-version : ${{ inputs.node-version }}
33+ cache : pnpm
34+ registry-url : ${{ inputs.registry-url }}
35+
36+ - name : Install dependencies
37+ shell : bash
38+ run : pnpm install --frozen-lockfile
Original file line number Diff line number Diff line change 99 name : Test
1010 runs-on : ubuntu-latest
1111 steps :
12- - name : Checkout
13- uses : actions/checkout@v4
12+ - uses : actions/checkout@v4
1413
15- - name : Setup pnpm
16- uses : pnpm/action-setup@v4
17- with :
18- version : 9
19-
20- - name : Setup Node.js
21- uses : actions/setup-node@v4
22- with :
23- node-version : ' 20'
24- cache : ' pnpm'
25-
26- - name : Install dependencies
27- run : pnpm install --frozen-lockfile
14+ - name : Setup workspace
15+ uses : ./.github/actions/setup-pnpm
2816
2917 - name : Run tests
3018 run : pnpm test
Original file line number Diff line number Diff line change 1+ name : Publish npm
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ permissions :
9+ contents : read
10+ id-token : write
11+
12+ concurrency :
13+ group : npm-publish-${{ github.ref }}
14+ cancel-in-progress : false
15+
16+ jobs :
17+ publish :
18+ name : Publish to npm
19+ runs-on : ubuntu-latest
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - name : Setup workspace
24+ uses : ./.github/actions/setup-pnpm
25+ with :
26+ registry-url : https://registry.npmjs.org
27+
28+ - name : Run tests
29+ run : pnpm test
30+
31+ - name : Build
32+ run : pnpm build
33+
34+ - name : Publish to npm
35+ run : |
36+ npm install -g npm@^11.5.1
37+ pnpm publish --no-git-checks
You can’t perform that action at this time.
0 commit comments