1+ name : Publish NPM Package
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+ branches :
8+ - main
9+ - publish-workflow
10+ workflow_dispatch :
11+ inputs :
12+ version :
13+ description : ' Package version to publish (e.g., 1.0.0)'
14+ required : true
15+ type : string
16+
17+ jobs :
18+ publish :
19+ runs-on : ubuntu-latest
20+
21+ steps :
22+ - name : Checkout code
23+ uses : actions/checkout@v4
24+
25+ - name : Setup Node.js
26+ uses : actions/setup-node@v4
27+ with :
28+ node-version : ' 18'
29+ cache : ' npm'
30+ cache-dependency-path : replayer-adapter-nodejs/package-lock.json
31+
32+ - name : Install dependencies
33+ run : |
34+ cd replayer-adapter-nodejs
35+ npm ci
36+
37+ - name : Build package
38+ run : |
39+ cd replayer-adapter-nodejs
40+ npm run build
41+
42+ - name : Run tests (if available)
43+ run : |
44+ cd replayer-adapter-nodejs
45+ npm test
46+ continue-on-error : true
47+
48+ # - name: Publish to NPM
49+ # if: startsWith(github.ref, 'refs/tags/v')
50+ # run: |
51+ # cd replayer-adapter-nodejs
52+ # npm publish --access public
53+ # env:
54+ # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55+
56+ - name : Private publish to NPM
57+ if : startsWith(github.ref, 'refs/tags/v')
58+ run : |
59+ cd replayer-adapter-nodejs
60+ npm publish --access public
61+ env :
62+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
63+
64+ - name : Manual publish to NPM
65+ if : github.event_name == 'workflow_dispatch'
66+ run : |
67+ cd replayer-adapter-nodejs
68+ # Update version in package.json if provided
69+ if [ -n "${{ github.event.inputs.version }}" ]; then
70+ npm version ${{ github.event.inputs.version }} --no-git-tag-version
71+ fi
72+ npm publish --access public
73+ env :
74+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
75+
76+ - name : Create GitHub Release
77+ if : startsWith(github.ref, 'refs/tags/v')
78+ uses : actions/create-release@v1
79+ env :
80+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
81+ with :
82+ tag_name : ${{ github.ref }}
83+ release_name : Release ${{ github.ref }}
84+ body : |
85+ ## Changes in this release
86+
87+ This release includes updates to the Temporal Workflow Debugger Node.js replayer adapter.
88+
89+ ### Package: @phuongdnguyen/replayer-adapter-nodejs
90+
91+ - Version: ${{ github.ref_name }}
92+ - Built from commit: ${{ github.sha }}
93+ draft : false
94+ prerelease : false
0 commit comments