Skip to content

Commit 1c89ae2

Browse files
committed
change prerelease version format to fix tagging
1 parent 5a48e35 commit 1c89ae2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

publish-client/action.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ runs:
5858
# Input tag is SemVer compliant, use it directly
5959
VERSION="$INPUT_TAG"
6060
echo "Input tag '$INPUT_TAG' is valid SemVer. Using version '$VERSION'."
61+
# Let npm publish determine the tag (latest or pre-release tag)
6162
else
6263
# Input tag is not SemVer, treat as branch/tag name
6364
echo "Input tag '$INPUT_TAG' is not valid SemVer. Generating pre-release version."
6465
# Sanitize the tag: replace non-alphanumeric/hyphen chars with hyphen
6566
SANITIZED_TAG=$(echo "$INPUT_TAG" | sed 's/[^a-zA-Z0-9-]/-/g')
66-
# Construct the version string: major.minor.0-tag-pipeline
67-
VERSION="${MAJOR}.${MINOR}.0-${SANITIZED_TAG}-${PIPELINE_ID}"
67+
# Construct the version string: major.minor.0-tag.pipeline
68+
VERSION="${MAJOR}.${MINOR}.0-${SANITIZED_TAG}.${PIPELINE_ID}"
6869
echo "Generated version: $VERSION"
70+
# Publish with a tag derived from the sanitized input tag - npm handles this automatically now
6971
fi
7072
7173
# Update package.json version
@@ -75,6 +77,9 @@ runs:
7577
head package.json # Keep for debugging output
7678
git config user.name "${GITHUB_ACTOR}"
7779
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
80+
echo "Publishing to NPM version '$VERSION'. Tag will be automatically determined by npm."
81+
# 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)
7883
npm publish
7984
shell: bash
8085
env:

0 commit comments

Comments
 (0)