Skip to content

Commit

Permalink
Only publish stable version to the latest tag (stripe#1450)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe authored Jun 13, 2022
1 parent d540367 commit bc16b2d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ jobs:
npm config set //registry.npmjs.org/:_authToken $NPM_AUTH_TOKEN
# print the NPM user name for validation
npm whoami
npm publish --otp="$(oathtool -b --totp $NPM_OTP)"
VERSION=$(npm -s run env echo '$npm_package_version')
# Only publish stable versions to the latest tag
if [[ "$VERSION" =~ ^[^-]+$ ]]; then
NPM_TAG="latest"
else
NPM_TAG="beta"
fi
echo "Publishing $VERSION with $NPM_TAG tag."
npm publish --otp="$(oathtool -b --totp $NPM_OTP)" --tag $NPM_TAG
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_OTP: ${{ secrets.NPM_OTP }}

0 comments on commit bc16b2d

Please sign in to comment.