Skip to content

Commit c3ea65f

Browse files
committed
publish replayer js to github npm registry
1 parent d5b17d3 commit c3ea65f

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

.github/workflows/publish-npm-package.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
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')
@@ -86,5 +100,8 @@ jobs:
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

replayer-adapter-nodejs/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@phuongdnguyen/replayer-adapter-nodejs",
33
"version": "1.0.0",
44
"description": "Replayer adapter and interceptors for Temporal Node.js workflows",
5+
"publishConfig": {
6+
"registry": "https://npm.pkg.github.com"
7+
},
58
"repository": {
69
"type": "git",
710
"url": "git+https://github.com/phuongdnguyen/temporal-workflow-replay-debugger.git",

0 commit comments

Comments
 (0)