Skip to content

Commit 164b3c8

Browse files
committed
chore: publish to npm with provenance
1 parent 31f9ba8 commit 164b3c8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

.github/workflows/nodejs.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ on: [push, pull_request]
44

55
jobs:
66
test:
7-
name: "Test on Node:${{ matrix.node-version }} OS:${{ matrix.os }}"
7+
name: 'Test on Node:${{ matrix.node-version }} OS:${{ matrix.os }}'
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
node-version: [18, 20]
11+
node-version: [20, 22]
1212
os: [ubuntu-latest]
1313
include:
1414
- os: windows-latest
15-
node-version: 20
15+
node-version: 22
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: setup Node.js ${{ matrix.node-version }}
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/cache@v2
2323
id: npm-cache
2424
with:
25-
path: "node_modules"
25+
path: 'node_modules'
2626
key: ${{ runner.os }}-node-v${{ matrix.node-version }}-npm-${{ hashFiles('package-lock.json') }}
2727
- run: npm install
2828
if: steps.npm-cache.outputs.cache-hit != 'true'
@@ -35,18 +35,21 @@ jobs:
3535
release:
3636
runs-on: ubuntu-latest
3737
needs: test
38+
permissions:
39+
contents: read
40+
id-token: write
3841
if: startsWith(github.ref, 'refs/tags/v')
3942
steps:
4043
- uses: actions/checkout@v3
4144
- name: Use Node.js
4245
uses: actions/setup-node@v3
4346
with:
44-
node-version: 20
45-
registry-url: "https://registry.npmjs.org"
47+
node-version: 22
48+
registry-url: 'https://registry.npmjs.org'
4649
- uses: actions/cache@v2
4750
id: npm-cache
4851
with:
49-
path: "node_modules"
52+
path: 'node_modules'
5053
key: ${{ runner.os }}-node-v20-npm-${{ hashFiles('package-lock.json') }}
5154
- run: npm install
5255
if: steps.npm-cache.outputs.cache-hit != 'true'
@@ -55,6 +58,6 @@ jobs:
5558
VERSION="$(node -e 'console.log(process.argv[1].match(/^refs\/tags\/v(\d+\.\d+\.\d+)$/)[1])' "${{ github.ref }}")"
5659
node -e 'console.log(JSON.stringify({...require("./package.json"),version:process.argv[1]}, null, 2))' "$VERSION" | tee ./tmp-package.json
5760
mv ./tmp-package.json ./package.json
58-
- run: npm publish
61+
- run: npm publish --provenance
5962
env:
6063
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)