Skip to content

Commit 0af43f3

Browse files
committed
Set a latest/next tag when publishing, depending on the release type
This may have been a requirement in npm 11, where in previous versions of npm, publishing a prerelease would set it on latest (which is not desirable)
1 parent 5373de4 commit 0af43f3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ jobs:
6060
node-version: '24.x'
6161
registry-url: 'https://registry.npmjs.org'
6262
cache: 'npm'
63-
- run: npm publish --provenance --access public
63+
- id: release_tag
64+
run: |
65+
VERSION=$(node -p "require('./package.json').version")
66+
if [[ "$VERSION" == *"-"* ]]; then
67+
echo "TAG=next" >> $GITHUB_ENV
68+
else
69+
echo "TAG=latest" >> $GITHUB_ENV
70+
fi
71+
- name: Publish to NPM
72+
run: npm publish --tag "$TAG" --provenance --access public
6473
env:
6574
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)