Skip to content

Commit dd1e8d1

Browse files
committed
ci: add publish npm package
1 parent ca4d0f6 commit dd1e8d1

File tree

1 file changed

+93
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)