File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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"
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
You can’t perform that action at this time.
0 commit comments