Skip to content

Commit 560fd7c

Browse files
committed
ci: ensure prerelease refs get correct npm tag
1 parent 1c89ae2 commit 560fd7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

publish-client/action.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ runs:
5959
VERSION="$INPUT_TAG"
6060
echo "Input tag '$INPUT_TAG' is valid SemVer. Using version '$VERSION'."
6161
# Let npm publish determine the tag (latest or pre-release tag)
62+
NPM_TAG_ARG=""
6263
else
6364
# Input tag is not SemVer, treat as branch/tag name
6465
echo "Input tag '$INPUT_TAG' is not valid SemVer. Generating pre-release version."
@@ -67,7 +68,8 @@ runs:
6768
# Construct the version string: major.minor.0-tag.pipeline
6869
VERSION="${MAJOR}.${MINOR}.0-${SANITIZED_TAG}.${PIPELINE_ID}"
6970
echo "Generated version: $VERSION"
70-
# Publish with a tag derived from the sanitized input tag - npm handles this automatically now
71+
# Explicitly publish with a tag derived from the sanitized input tag
72+
NPM_TAG_ARG="--tag ${SANITIZED_TAG}"
7173
fi
7274
7375
# Update package.json version
@@ -77,10 +79,9 @@ runs:
7779
head package.json # Keep for debugging output
7880
git config user.name "${GITHUB_ACTOR}"
7981
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
80-
echo "Publishing to NPM version '$VERSION'. Tag will be automatically determined by npm."
82+
echo "Publishing to NPM version '$VERSION' with tag arguments: '$NPM_TAG_ARG'"
8183
# Note: The space before $NPM_TAG_ARG is important if it's non-empty
82-
# Npm automatically determines the tag (latest for standard, pre-id for pre-releases)
83-
npm publish
84+
npm publish $NPM_TAG_ARG
8485
shell: bash
8586
env:
8687
GITHUB_TOKEN : ${{ env.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)