From 5cb0432116bc685ee8df611201659630b9713318 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bianchi Date: Wed, 15 Apr 2026 11:21:59 +0200 Subject: [PATCH] chore: tag prerelease version when publishing Signed-off-by: Jean-Baptiste Bianchi --- .github/workflows/npmjs-release.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npmjs-release.yml b/.github/workflows/npmjs-release.yml index 4219ada..0d69d5e 100644 --- a/.github/workflows/npmjs-release.yml +++ b/.github/workflows/npmjs-release.yml @@ -31,4 +31,24 @@ jobs: - run: npm test - run: npm run build - run: npm run validate:package:dist - - run: cd dist && npm publish --access=public \ No newline at end of file + - name: Publish to npm + shell: bash + run: | + VERSION="$(node -p "require('./dist/package.json').version")" + + if [[ "$VERSION" == *-* ]]; then + PRERELEASE_TAG="${VERSION#*-}" + PRERELEASE_TAG="${PRERELEASE_TAG%%[0-9]*}" + + if [[ -z "$PRERELEASE_TAG" ]]; then + PRERELEASE_TAG="next" + fi + + echo "Publishing prerelease $VERSION with tag '$PRERELEASE_TAG'" + cd dist + npm publish --access public --tag "$PRERELEASE_TAG" + else + echo "Publishing stable release $VERSION with tag 'latest'" + cd dist + npm publish --access public + fi \ No newline at end of file