Skip to content

Commit 906e9e3

Browse files
committed
ci(publish): NPM_TOKEN fallback, prerelease --tag beta, workflow_dispatch
- Same contract as mcp-client publish workflow Made-with: Cursor
1 parent 5b768c2 commit 906e9e3

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

.github/workflows/publish.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
name: Publish @spawn-dock/dev-tunnel
22

33
on:
4+
workflow_dispatch:
45
push:
56
tags:
67
- "v*"
78
branches:
89
- main
910

11+
concurrency:
12+
group: publish-${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1015
env:
1116
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1217

@@ -25,7 +30,17 @@ jobs:
2530
node-version: 22.12.0
2631
registry-url: https://registry.npmjs.org
2732

33+
- name: Verify npm auth secret
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || secrets.NPM_KEY }}
36+
run: |
37+
if [[ -z "${NODE_AUTH_TOKEN}" ]]; then
38+
echo "Missing npm auth. Set repository secret NPM_TOKEN (or NPM_KEY)." >&2
39+
exit 1
40+
fi
41+
2842
- run: npm ci
43+
2944
- name: Determine version type
3045
id: version
3146
run: |
@@ -48,14 +63,20 @@ jobs:
4863

4964
- run: npm run build
5065

51-
- name: Publish release
66+
- name: Publish release (stable or prerelease)
5267
if: steps.version.outputs.type == 'release'
53-
run: npm publish
5468
env:
55-
NODE_AUTH_TOKEN: ${{ secrets.NPM_KEY }}
69+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || secrets.NPM_KEY }}
70+
run: |
71+
VERSION="${{ steps.version.outputs.version }}"
72+
if [[ "$VERSION" == *-* ]]; then
73+
npm publish --access public --tag beta
74+
else
75+
npm publish --access public
76+
fi
5677
5778
- name: Publish canary
5879
if: steps.version.outputs.type == 'canary'
59-
run: npm publish --tag canary
6080
env:
61-
NODE_AUTH_TOKEN: ${{ secrets.NPM_KEY }}
81+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || secrets.NPM_KEY }}
82+
run: npm publish --access public --tag canary

0 commit comments

Comments
 (0)