Skip to content

Commit 2f4028c

Browse files
committed
ci: auto-publish npm package on version tags (needs NPM_TOKEN secret)
Mirrors the existing PyPI release workflow so npm never lags a release. Guards that the tag matches openclaw-plugin's package.json version.
1 parent 3d6c5c9 commit 2f4028c

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/release-npm.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release npm package
2+
3+
# Auto-publish the OpenClaw plugin (@cortex-ai-memory/cortex-memory) to npm on every
4+
# version tag, so npm never lags a release. Requires the NPM_TOKEN repo secret
5+
# (an npm automation token with publish rights to the @cortex-ai-memory scope).
6+
on:
7+
push:
8+
tags: ['v*']
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
publish:
16+
name: Publish to npm
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
registry-url: 'https://registry.npmjs.org'
24+
- name: Guard — package version must match the tag
25+
run: |
26+
TAG="${GITHUB_REF_NAME#v}"
27+
PKG=$(node -p "require('./openclaw-plugin/package.json').version")
28+
if [ "$TAG" != "$PKG" ]; then
29+
echo "::error::tag $TAG != openclaw-plugin version $PKG — bump the manifest"
30+
exit 1
31+
fi
32+
- name: Build & publish
33+
working-directory: openclaw-plugin
34+
run: |
35+
npm install
36+
npm run build
37+
npm publish --access public
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)