Skip to content

Commit a945b23

Browse files
chore(ci): correctly tag pre-release npm packages (#963)
1 parent 29b56c6 commit a945b23

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Diff for: bin/publish-npm

+18-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22

33
set -eux
44

5-
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
5+
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
66

7+
# Build the project
78
yarn build
9+
10+
# Navigate to the dist directory
811
cd dist
9-
yarn publish --access public
12+
13+
# Get the version from package.json
14+
VERSION="$(node -p "require('./package.json').version")"
15+
16+
# Extract the pre-release tag if it exists
17+
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
18+
# Extract the part before any dot in the pre-release identifier
19+
TAG="${BASH_REMATCH[1]}"
20+
else
21+
TAG="latest"
22+
fi
23+
24+
# Publish with the appropriate tag
25+
yarn publish --access public --tag "$TAG"

0 commit comments

Comments
 (0)