88 - " v[0-9]+*"
99 workflow_dispatch :
1010
11+ permissions :
12+ contents : read
13+
1114jobs :
1215 build :
16+ if : >-
17+ github.repository == 'WaveSpeedAI/wavespeed-javascript' &&
18+ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
19+ (github.ref == 'refs/heads/main' ||
20+ (github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')))
21+ environment : package-build
1322 runs-on : ubuntu-latest
1423
1524 steps :
1625 - name : Checkout code
17- uses : actions/checkout@v4
26+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1827 with :
1928 fetch-depth : 0
29+ persist-credentials : false
2030
2131 - name : Setup Node.js
22- uses : actions/setup-node@v4
32+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2333 with :
2434 node-version : ' 20'
2535 cache : ' npm'
4252 run : npm pack
4353
4454 - run : ls -lh *.tgz
45- - uses : actions/upload-artifact@v4
55+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
4656 with :
4757 name : npm-packages
4858 path : |
@@ -52,15 +62,22 @@ jobs:
5262 gh_release :
5363 name : gh_release
5464 needs : build
65+ if : >-
66+ github.repository == 'WaveSpeedAI/wavespeed-javascript' &&
67+ github.event_name == 'push' &&
68+ (github.ref == 'refs/heads/main' ||
69+ (github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')))
70+ environment : github-release
5571 runs-on : ubuntu-latest
56- permissions : write-all
72+ permissions :
73+ contents : write
5774
5875 timeout-minutes : 60
5976 defaults :
6077 run :
6178 shell : bash
6279 steps :
63- - uses : actions/download-artifact@v4
80+ - uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
6481 with :
6582 path : dist
6683
6986 # create nightly release if it's a push to main
7087 - if : github.repository == 'WaveSpeedAI/wavespeed-javascript' && github.event_name == 'push' && github.ref == 'refs/heads/main'
7188 name : Nightly Release
72- uses : andelf/nightly-release@v1
89+ uses : andelf/nightly-release@c5ed4bdb7c1da04a4fa1e40bc5e67306f682563b # v1
7390 env :
7491 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7592 with :
83100 # create release if it's a tag like vx.y.z
84101 - if : github.repository == 'WaveSpeedAI/wavespeed-javascript' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
85102 name : Release
86- uses : softprops/action-gh-release@v1
103+ uses : softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
87104 with :
88105 files : |
89106 dist/*/*.tgz
0 commit comments