2525 node-version : ' 18'
2626 cache : ' npm'
2727 cache-dependency-path : replayer-adapter-nodejs/package-lock.json
28+ # Configure for both registries
2829 registry-url : ' https://registry.npmjs.org'
2930
3031 - name : Install dependencies
@@ -43,31 +44,44 @@ jobs:
4344 npm test
4445 continue-on-error : true
4546
46- # - name: Publish to NPM
47- # if: startsWith(github.ref, 'refs/tags/replayer-adapter-nodejs-v')
48- # run: |
49- # cd replayer-adapter-nodejs
50- # npm publish --access public
51- # env:
52- # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53-
54- - name : Publish to NPM
47+ # Publish to NPM Registry
48+ - name : Publish to NPM Registry
5549 if : startsWith(github.ref, 'refs/tags/replayer-adapter-nodejs-v')
5650 run : |
5751 cd replayer-adapter-nodejs
5852 echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
5953 npm publish --access public
6054
61- - name : Manual publish to NPM
55+ # Publish to GitHub Packages
56+ - name : Publish to GitHub Packages
57+ if : startsWith(github.ref, 'refs/tags/replayer-adapter-nodejs-v')
58+ run : |
59+ cd replayer-adapter-nodejs
60+ echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
61+ echo "@phuongdnguyen:registry=https://npm.pkg.github.com" >> .npmrc
62+ npm publish
63+
64+ # Manual publish to both registries
65+ - name : Manual publish to NPM Registry
6266 if : github.event_name == 'workflow_dispatch'
6367 run : |
6468 cd replayer-adapter-nodejs
6569 echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
66- # Update version in package.json if provided
6770 if [ -n "${{ github.event.inputs.version }}" ]; then
6871 npm version ${{ github.event.inputs.version }} --no-git-tag-version
6972 fi
7073 npm publish --access public
74+
75+ - name : Manual publish to GitHub Packages
76+ if : github.event_name == 'workflow_dispatch'
77+ run : |
78+ cd replayer-adapter-nodejs
79+ echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
80+ echo "@phuongdnguyen:registry=https://npm.pkg.github.com" >> .npmrc
81+ if [ -n "${{ github.event.inputs.version }}" ]; then
82+ npm version ${{ github.event.inputs.version }} --no-git-tag-version
83+ fi
84+ npm publish
7185
7286 - name : Create GitHub Release
7387 if : startsWith(github.ref, 'refs/tags/replayer-adapter-nodejs-v')
86100
87101 - Version: ${{ github.ref_name }}
88102 - Built from commit: ${{ github.sha }}
103+ - Available on:
104+ - NPM Registry: `npm install @phuongdnguyen/replayer-adapter-nodejs`
105+ - GitHub Packages: `npm install @phuongdnguyen/replayer-adapter-nodejs`
89106 draft : false
90107 prerelease : false
0 commit comments