Skip to content

Commit

Permalink
chore(ci): correctly tag pre-release npm packages (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jul 31, 2024
1 parent 29b56c6 commit a945b23
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@

set -eux

npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"

# Build the project
yarn build

# Navigate to the dist directory
cd dist
yarn publish --access public

# Get the version from package.json
VERSION="$(node -p "require('./package.json').version")"

# Extract the pre-release tag if it exists
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
# Extract the part before any dot in the pre-release identifier
TAG="${BASH_REMATCH[1]}"
else
TAG="latest"
fi

# Publish with the appropriate tag
yarn publish --access public --tag "$TAG"

0 comments on commit a945b23

Please sign in to comment.