We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 29b56c6 commit a945b23Copy full SHA for a945b23
bin/publish-npm
@@ -2,8 +2,24 @@
2
3
set -eux
4
5
-npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
+npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
6
7
+# Build the project
8
yarn build
9
+
10
+# Navigate to the dist directory
11
cd dist
-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