Skip to content

Commit 4d94f0e

Browse files
committed
Fix npm prerelease tag in release workflow
1 parent 3b30fe9 commit 4d94f0e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,19 @@ jobs:
113113
node-version: "20"
114114
registry-url: "https://registry.npmjs.org"
115115

116+
- name: Determine npm tag
117+
id: npm-tag
118+
run: |
119+
TAG_NAME="${GITHUB_REF#refs/tags/}"
120+
if echo "$TAG_NAME" | grep -qE 'beta|rc|alpha'; then
121+
echo "tag=beta" >> "$GITHUB_OUTPUT"
122+
else
123+
echo "tag=latest" >> "$GITHUB_OUTPUT"
124+
fi
125+
env:
126+
GITHUB_REF: ${{ github.ref }}
127+
116128
- name: Publish to npm
117-
run: npm publish --access public
129+
run: npm publish --access public --tag ${{ steps.npm-tag.outputs.tag }}
118130
env:
119131
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)