From 0daa5d7d034ea05c1b195fcab5c3964250c956ee Mon Sep 17 00:00:00 2001 From: Saket Aryan Date: Fri, 3 Apr 2026 21:17:11 +0530 Subject: [PATCH] fix(ci): handle npm prerelease publish across Node.js CD workflows (#4690) Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/cli-node-cd.yml | 8 +++++++- .github/workflows/openclaw-cd.yml | 8 +++++++- .github/workflows/ts-sdk-cd.yml | 8 +++++++- .github/workflows/vercel-ai-cd.yml | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli-node-cd.yml b/.github/workflows/cli-node-cd.yml index 9190bf661..113de7b1c 100644 --- a/.github/workflows/cli-node-cd.yml +++ b/.github/workflows/cli-node-cd.yml @@ -40,4 +40,10 @@ jobs: run: pnpm run build - name: Publish to npm - run: npm publish --provenance --access public + run: | + if [ "${{ github.event.release.prerelease }}" = "true" ]; then + PREID=$(node -p "require('./package.json').version.split('-')[1].split('.')[0]") + npm publish --provenance --access public --tag "$PREID" + else + npm publish --provenance --access public + fi diff --git a/.github/workflows/openclaw-cd.yml b/.github/workflows/openclaw-cd.yml index eaa26768b..9c60cb149 100644 --- a/.github/workflows/openclaw-cd.yml +++ b/.github/workflows/openclaw-cd.yml @@ -40,4 +40,10 @@ jobs: run: pnpm build - name: Publish to npm - run: npm publish --provenance --access public + run: | + if [ "${{ github.event.release.prerelease }}" = "true" ]; then + PREID=$(node -p "require('./package.json').version.split('-')[1].split('.')[0]") + npm publish --provenance --access public --tag "$PREID" + else + npm publish --provenance --access public + fi diff --git a/.github/workflows/ts-sdk-cd.yml b/.github/workflows/ts-sdk-cd.yml index 74163a323..8d3f64343 100644 --- a/.github/workflows/ts-sdk-cd.yml +++ b/.github/workflows/ts-sdk-cd.yml @@ -40,4 +40,10 @@ jobs: run: pnpm run build - name: Publish to npm - run: npm publish --provenance --access public + run: | + if [ "${{ github.event.release.prerelease }}" = "true" ]; then + PREID=$(node -p "require('./package.json').version.split('-')[1].split('.')[0]") + npm publish --provenance --access public --tag "$PREID" + else + npm publish --provenance --access public + fi diff --git a/.github/workflows/vercel-ai-cd.yml b/.github/workflows/vercel-ai-cd.yml index 6cc2a4995..168d9730e 100644 --- a/.github/workflows/vercel-ai-cd.yml +++ b/.github/workflows/vercel-ai-cd.yml @@ -40,4 +40,10 @@ jobs: run: pnpm run build - name: Publish to npm - run: npm publish --provenance --access public + run: | + if [ "${{ github.event.release.prerelease }}" = "true" ]; then + PREID=$(node -p "require('./package.json').version.split('-')[1].split('.')[0]") + npm publish --provenance --access public --tag "$PREID" + else + npm publish --provenance --access public + fi