55 branches : master
66
77jobs :
8- publish :
8+ build :
99 runs-on : ubuntu-latest
1010
1111 steps :
1717 with :
1818 node-version : " 20"
1919 registry-url : ' https://registry.npmjs.org'
20+
21+ - name : Install dependencies
22+ run : npm ci
23+
24+ - name : Build project
25+ run : npm run build
26+
27+ - name : Upload build artifacts
28+ uses : actions/upload-artifact@v3
29+ with :
30+ name : build-artifacts
31+ path : ./build # Adjust this path to your actual build output
32+
33+ npm_publish :
34+ runs-on : ubuntu-latest
35+ needs : build
36+
37+ steps :
38+ - name : Checkout code
39+ uses : actions/checkout@v4
40+
41+ - name : Download build artifacts
42+ uses : actions/download-artifact@v3
43+ with :
44+ name : build-artifacts
2045
46+ - name : Setup Node.js
47+ uses : actions/setup-node@v3
48+ with :
49+ node-version : " 20"
50+ registry-url : ' https://registry.npmjs.org'
51+
2152 - name : Install dependencies
2253 run : npm ci
2354
@@ -26,16 +57,45 @@ jobs:
2657 with :
2758 token : ${{ secrets.NPM_TOKEN }}
2859
60+ github_publish :
61+ runs-on : ubuntu-latest
62+ needs : build
63+
64+ steps :
65+ - name : Checkout code
66+ uses : actions/checkout@v4
67+
68+ - name : Download build artifacts
69+ uses : actions/download-artifact@v3
70+ with :
71+ name : build-artifacts
72+
73+ - name : Setup Node.js
74+ uses : actions/setup-node@v3
75+ with :
76+ node-version : " 20"
77+
2978 - name : Configure .npmrc for GitHub Packages
3079 run : |
3180 echo "//npm.pkg.github.com/:_authToken=\${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
3281 echo "@${{ secrets.GITHUB_USERNAME }}:registry=https://npm.pkg.github.com" >> ~/.npmrc
3382
83+ - name : Install dependencies
84+ run : npm ci
85+
3486 - name : Publish to GitHub Packages
3587 run : npm publish
3688 env :
3789 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3890
91+ create_release :
92+ runs-on : ubuntu-latest
93+ needs : [npm_publish, github_publish]
94+
95+ steps :
96+ - name : Checkout code
97+ uses : actions/checkout@v4
98+
3999 - name : Create GitHub Release
40100 id : create_release
41101 uses : actions/create-release@v1
0 commit comments