Skip to content

Commit 2ae2a88

Browse files
committed
Update publish.yml
1 parent 5874c07 commit 2ae2a88

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,21 @@ jobs:
3939
- name: Build project
4040
run: pnpm run build
4141

42-
- name: Check if version already exists
42+
- name: Check version and determine publish tag
4343
id: check-version
4444
run: |
4545
VERSION=$(node -p "require('./package.json').version")
4646
PACKAGE_NAME=$(node -p "require('./package.json').name")
47+
48+
# Check if version contains beta
49+
if [[ "$VERSION" == *"beta"* ]]; then
50+
echo "tag=beta" >> $GITHUB_OUTPUT
51+
echo "Version $VERSION contains beta, will publish with beta tag"
52+
else
53+
echo "tag=latest" >> $GITHUB_OUTPUT
54+
echo "Version $VERSION is stable, will publish with latest tag"
55+
fi
56+
4757
if npm view ${PACKAGE_NAME}@${VERSION} version > /dev/null 2>&1; then
4858
echo "exists=true" >> $GITHUB_OUTPUT
4959
echo "Version $VERSION already exists on npm, skipping publish"
@@ -54,5 +64,5 @@ jobs:
5464
5565
- name: Publish to npm
5666
if: steps.check-version.outputs.exists == 'false'
57-
run: npm publish --access public --provenance
67+
run: npm publish --access public --provenance --tag ${{ steps.check-version.outputs.tag }}
5868
continue-on-error: false

0 commit comments

Comments
 (0)