File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Release CI
2
+ on :
3
+ push :
4
+ tags :
5
+ - ' v[0-9]+(\.[0-9]+){2}(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'
6
+
7
+ jobs :
8
+ release :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : " Checkout code"
13
+ uses : actions/checkout@v4
14
+
15
+ - name : Set up Node.js
16
+ uses : actions/setup-node@v4
17
+ with :
18
+ node-version : ' lts/*'
19
+ registry-url : ' https://registry.npmjs.org'
20
+
21
+ - name : Extract prerelease tag if present
22
+ id : extract-tag
23
+ run : |
24
+ TAG="${GITHUB_REF_NAME#v}" # Remove the "v" prefix
25
+ if [[ "$TAG" == *-* ]]; then
26
+ PRERELEASE=${TAG#*-} # Remove everything before the dash
27
+ PRERELEASE=${PRERELEASE%%.*} # Remove everything after the first period
28
+ else
29
+ PRERELEASE="latest"
30
+ fi
31
+ echo "dist-tag=$PRERELEASE" >> $GITHUB_ENV
32
+
33
+ - name : Install npm dependencies
34
+ run : npm install
35
+
36
+ - name : Publish to npmjs.org
37
+ env :
38
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
39
+ run : |
40
+ echo "Publishing to npmjs.org using dist-tag: $dist-tag"
41
+ npm publish --access=public --tag "$dist-tag"
42
+
43
+ - name : Set up auth for GitHub packages
44
+ run : |
45
+ npm config set "//npm.pkg.github.com/:_authToken" "\${NODE_AUTH_TOKEN}"
46
+
47
+ - name : Publish to GitHub packages
48
+ env :
49
+ NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50
+ run : |
51
+ npm config set "@fastly:registry" "https://npm.pkg.github.com/"
52
+ echo "Publishing to npm.pkg.github.com using dist-tag: $dist-tag"
53
+ npm publish --access=public --tag "$dist-tag"
You can’t perform that action at this time.
0 commit comments