11# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
22# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
33
4- name : Node.js Package for GitHub Packages
4+ name : Node.js Package
55
66on :
77 release :
88 types : [ published ]
9+ workflow_dispatch : # Added manual trigger option
910
1011permissions :
1112 contents : read
2122 - uses : actions/setup-node@v4
2223 with :
2324 node-version : 20
25+ cache : ' npm' # Added caching
2426 - run : npm ci
27+ - run : npx lerna run build
28+ # - run: npx lerna run test
29+ - name : Upload build artifacts
30+ uses : actions/upload-artifact@v4
31+ with :
32+ name : build-output
33+ path : packages/
2534
2635 publish-gpr :
2736 needs : build
@@ -34,15 +43,23 @@ jobs:
3443 - uses : actions/setup-node@v4
3544 with :
3645 node-version : 20
46+ cache : ' npm'
3747 registry-url : https://npm.pkg.github.com/
48+ - name : Download build artifacts
49+ uses : actions/download-artifact@v4
50+ with :
51+ name : build-output
52+ path : packages/
3853 - run : npm ci
39- - run : npx lerna run build
4054 - run : cp README.md packages/stencil-library
55+ - name : Configure GitHub Packages scope
56+ run : echo "@$(echo '${{ github.repository }}' | cut -d '/' -f 1):registry=https://npm.pkg.github.com" >> .npmrc
4157 - run : npx lerna publish from-package --yes
4258 env :
4359 NODE_AUTH_TOKEN : ${{secrets.GITHUB_TOKEN}}
4460
4561 publish-npm :
62+ needs : build
4663 runs-on : ubuntu-latest
4764 permissions :
4865 contents : read
5168 - uses : actions/setup-node@v4
5269 with :
5370 node-version : 20
71+ cache : ' npm'
5472 registry-url : https://registry.npmjs.org/
55- - run : npm clean-install
56- - run : npx lerna run build
73+ - name : Download build artifacts
74+ uses : actions/download-artifact@v4
75+ with :
76+ name : build-output
77+ path : packages/
78+ - run : npm ci
5779 - run : cp README.md packages/stencil-library
5880 - run : npx lerna publish from-package --yes
5981 env :
0 commit comments