From 52ce2c995c643abdb7e25fc3306c1803127a61d5 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 4 Mar 2026 01:35:10 +0800 Subject: [PATCH] fix(ci): only run npm publish on release tags (#3093) This PR fixes the npm publish dry-run failure for prerelease versions without changing the existing workflow trigger behavior. The publish step now detects prerelease versions from `nodejs/package.json` and always appends `--tag preview` when needed. Context: - On `main` pushes, the workflow still runs `npm publish --dry-run` by design. - Recent failures were caused by prerelease versions (for example `0.27.0-beta.3`) running without `--tag`, which npm rejects. - The previous `refs/tags/v...-beta...` check did not apply on branch pushes, so dry-run could fail even though release tags worked. --- .github/workflows/npm-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 6e73d5e83..438eba87c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -356,7 +356,8 @@ jobs: if [[ $DRY_RUN == "true" ]]; then ARGS="$ARGS --dry-run" fi - if [[ $GITHUB_REF =~ refs/tags/v(.*)-beta.* ]]; then + VERSION=$(node -p "require('./package.json').version") + if [[ $VERSION == *-* ]]; then ARGS="$ARGS --tag preview" fi npm publish $ARGS