11name : CI
2-
2+ permissions :
3+ contents : write
4+ pull-requests : write
35on :
46 push :
57 branches :
911 - main
1012
1113jobs :
12- test :
14+ build :
1315 runs-on : ubuntu-latest
1416 strategy :
1517 matrix :
@@ -19,66 +21,50 @@ jobs:
1921 steps :
2022 - uses : actions/checkout@v2
2123 - name : Use Node.js ${{ matrix.node-version }}
22- uses : actions/setup-node@v1
24+ uses : actions/setup-node@v6
2325 with :
2426 node-version : ${{ matrix.node-version }}
2527 - run : npm ci
26- - run : npm run build
2728 - run : npm test
29+ - run : npm run build
2830 - name : Save build
2931 if : matrix.node-version == '20.x'
30- uses : actions/upload-artifact@v4
32+ uses : actions/upload-artifact@v5
3133 with :
3234 name : build
3335 path : |
3436 .
3537 !node_modules
3638 retention-days : 1
3739
38- gh-pages :
39- needs : test
40- runs-on : ubuntu-latest
41- if : github.ref == 'refs/heads/main'
42- permissions :
43- contents : write
44- pages : write
45- steps :
46- - uses : actions/download-artifact@v4
47- with :
48- name : build
49- - uses : peaceiris/actions-gh-pages@v3
50- with :
51- github_token : ${{ github.token }}
52- publish_dir : .
53-
5440 npm-publish-build :
55- needs : test
41+ needs : build
5642 runs-on : ubuntu-latest
5743 steps :
58- - uses : actions/download-artifact@v4
44+ - uses : actions/download-artifact@v6
5945 with :
6046 name : build
61- - uses : actions/setup-node@v1
47+ - uses : actions/setup-node@v6
6248 with :
6349 node-version : 20.x
6450 - uses : rlespinasse/github-slug-action@v3.x
6551 - name : Append commit hash to package version
6652 run : ' sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
6753 - name : Disable pre- and post-publish actions
6854 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
69- - uses : JS-DevTools/npm-publish@v1
55+ - uses : JS-DevTools/npm-publish@v4.1.0
7056 with :
7157 token : ${{ secrets.NPM_TOKEN }}
7258 tag : ${{ env.GITHUB_REF_SLUG }}
7359 npm-publish-latest :
74- needs : test
60+ needs : [build, npm-publish-build]
7561 runs-on : ubuntu-latest
7662 if : github.ref == 'refs/heads/main'
7763 steps :
78- - uses : actions/download-artifact@v4
64+ - uses : actions/download-artifact@v6
7965 with :
8066 name : build
81- - uses : actions/setup-node@v1
67+ - uses : actions/setup-node@v6
8268 with :
8369 node-version : 20.x
8470 - name : Disable pre- and post-publish actions
0 commit comments