Skip to content

Commit 9ba31f7

Browse files
committed
ci: allow ci to publish with next tag for pre-releases
1 parent e12c972 commit 9ba31f7

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ jobs:
4141
with:
4242
name: dist
4343
path: dist/
44-
- run: npm publish --provenance --access public
44+
- name: Set NPM tag
45+
id: npm_tag
46+
run: |
47+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
48+
echo "tag=next" >> $GITHUB_OUTPUT
49+
else
50+
echo "tag=latest" >> $GITHUB_OUTPUT
51+
fi
52+
- run: npm publish --provenance --access public --tag ${{ steps.npm_tag.outputs.tag }}
4553
env:
4654
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4755

@@ -64,6 +72,14 @@ jobs:
6472
name: dist
6573
path: dist/
6674
- run: node gpr-hack.js
67-
- run: npm publish
75+
- name: Set GPR tag
76+
id: gpr_tag
77+
run: |
78+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
79+
echo "tag=next" >> $GITHUB_OUTPUT
80+
else
81+
echo "tag=latest" >> $GITHUB_OUTPUT
82+
fi
83+
- run: npm publish --tag ${{ steps.gpr_tag.outputs.tag }}
6884
env:
6985
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)