Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only publish stable version to the latest tag #1450

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}