1717 - 14.x
1818 - 16.x
1919 steps :
20- - uses : actions/checkout@v2
20+ - uses : actions/checkout@v4
2121 - name : Use Node.js ${{ matrix.node-version }}
22- uses : actions/setup-node@v1
22+ uses : actions/setup-node@v4
2323 with :
2424 node-version : ${{ matrix.node-version }}
2525 - run : npm ci
2828 - run : npm run build
2929 - name : Save build
3030 if : matrix.node-version == '14.x'
31- uses : actions/upload-artifact@v2
31+ uses : actions/upload-artifact@v4
3232 with :
3333 name : build
3434 path : |
@@ -39,37 +39,45 @@ jobs:
3939 npm-publish-build :
4040 needs : test
4141 runs-on : ubuntu-latest
42+ permissions :
43+ id-token : write # Required for OIDC
44+ contents : read
4245 steps :
43- - uses : actions/download-artifact@v2
46+ - uses : actions/download-artifact@v4
4447 with :
4548 name : build
46- - uses : actions/setup-node@v1
49+ - uses : actions/setup-node@v4
4750 with :
48- node-version : 14.x
51+ node-version : 20.x
52+ registry-url : ' https://registry.npmjs.org'
53+ - name : Update npm to latest (required for OIDC)
54+ run : npm install -g npm@latest
4955 - uses : rlespinasse/github-slug-action@v3.x
5056 - name : Append commit hash to package version
5157 run : ' sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
5258 - name : Disable pre- and post-publish actions
5359 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
54- - uses : JS-DevTools/npm-publish@v1
55- with :
56- token : ${{ secrets.NPM_TOKEN }}
57- tag : ${{ env.GITHUB_REF_SLUG }}
60+ - name : Publish to npm
61+ run : npm publish --tag ${{ env.GITHUB_REF_SLUG }}
5862
5963 npm-publish-latest :
6064 needs : test
6165 runs-on : ubuntu-latest
6266 if : github.ref == 'refs/heads/main'
67+ permissions :
68+ id-token : write # Required for OIDC
69+ contents : read
6370 steps :
64- - uses : actions/download-artifact@v2
71+ - uses : actions/download-artifact@v4
6572 with :
6673 name : build
67- - uses : actions/setup-node@v1
74+ - uses : actions/setup-node@v4
6875 with :
69- node-version : 14.x
76+ node-version : 20.x
77+ registry-url : ' https://registry.npmjs.org'
78+ - name : Update npm to latest (required for OIDC)
79+ run : npm install -g npm@latest
7080 - name : Disable pre- and post-publish actions
7181 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
72- - uses : JS-DevTools/npm-publish@v1
73- with :
74- token : ${{ secrets.NPM_TOKEN }}
75- tag : latest
82+ - name : Publish to npm
83+ run : npm publish --tag latest
0 commit comments