Skip to content

Commit 3d6064b

Browse files
committed
ci(publish): route 5.0 branch to @next dist-tag and pre-release
Adds "5.0" to the push triggers and picks npm tag + GitHub prerelease flag from the branch name — master keeps @latest / stable releases, 5.0 publishes as @next and marks the GitHub release pre-release. Assisted-by: Claude Opus 4.7
1 parent 764d244 commit 3d6064b

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- master
10+
- "5.0"
1011

1112
jobs:
1213
npm-publish:
@@ -33,9 +34,21 @@ jobs:
3334
file-name: package.json
3435
diff-search: true
3536

37+
# master → @latest, stable GitHub release.
38+
# 5.0 → @next, pre-release GitHub release.
39+
- id: release
40+
run: |
41+
if [ "${{ github.ref_name }}" = "master" ]; then
42+
echo "npm_tag=latest" >> "$GITHUB_OUTPUT"
43+
echo "prerelease=false" >> "$GITHUB_OUTPUT"
44+
else
45+
echo "npm_tag=next" >> "$GITHUB_OUTPUT"
46+
echo "prerelease=true" >> "$GITHUB_OUTPUT"
47+
fi
48+
3649
- name: Publish package on NPM 📦
3750
if: steps.check.outputs.changed == 'true'
38-
run: npm publish
51+
run: npm publish --tag ${{ steps.release.outputs.npm_tag }}
3952
env:
4053
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4154

@@ -44,5 +57,5 @@ jobs:
4457
uses: softprops/action-gh-release@v2
4558
with:
4659
tag_name: ${{ steps.check.outputs.version }}
47-
prerelease: false
60+
prerelease: ${{ steps.release.outputs.prerelease }}
4861

0 commit comments

Comments
 (0)