fix: allow prerelease tags (#1099)

This commit is contained in:
Carson Roscoe 2026-02-05 13:15:21 -08:00 committed by GitHub
parent 93dbae6d8e
commit 885514cbc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,7 +49,21 @@ jobs:
# Check if running on main branch
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "Publishing to NPM (main branch)"
pnpm publish --provenance --access public
# Check if version is a prerelease (contains -alpha, -beta, -rc, etc.)
if [[ "$PACKAGE_VERSION" =~ -[a-zA-Z] ]]; then
# Extract prerelease tag (e.g., "alpha" from "2.3.0-alpha")
PRERELEASE_TAG=$(echo "$PACKAGE_VERSION" | sed -n 's/.*-\([a-zA-Z][a-zA-Z0-9]*\).*/\1/p')
if [ -z "$PRERELEASE_TAG" ]; then
# Fallback: use "pre" if we can't extract a tag
PRERELEASE_TAG="pre"
fi
echo "Detected prerelease version, publishing with tag: $PRERELEASE_TAG"
pnpm publish --provenance --access public --tag "$PRERELEASE_TAG"
else
echo "Publishing stable version"
pnpm publish --provenance --access public
fi
else
echo "Dry run only (non-main branch: ${{ github.ref }})"
pnpm publish --dry-run --no-git-checks