Skip to content

Commit d397113

Browse files
committed
chore: ci
1 parent d24b58d commit d397113

File tree

2 files changed

+18
-57
lines changed

2 files changed

+18
-57
lines changed

.github/workflows/publish-npm-nightly.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/publish-npm.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- uses: actions/setup-node@v5
2222
with:
2323
node-version: 24
24-
package-manager-cache: false
2524
registry-url: "https://registry.npmjs.org"
2625

2726
# Ensure npm 11.5.1 or later is installed:
@@ -34,6 +33,23 @@ jobs:
3433
env:
3534
CI: true
3635

36+
- name: Determine type of release
37+
id: release-tag
38+
run: |
39+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
40+
echo "Publish latest"
41+
echo "tag=latest" >> $GITHUB_OUTPUT
42+
else
43+
echo "Publish nightly"
44+
echo "tag=nightly" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Bump version to prerelease
48+
if: github.ref != 'refs/heads/main'
49+
run: |
50+
PRERELEASE_TAG=nightly-$(echo "${{ github.ref_name }}" | sed -r 's/[^a-z0-9]+/-/gi')
51+
npm version prerelease --preid $PRERELEASE_TAG-$COMMIT_DATE-$GIT_HASH
52+
3753
- name: Generate types
3854
run: npm run generate-types
3955
env:
@@ -45,6 +61,6 @@ jobs:
4561
CI: true
4662

4763
- name: Publish to NPM
48-
run: npm publish --tag latest
64+
run: npm publish --tag ${{ steps.release-tag.outputs.tag }}
4965
env:
5066
CI: true

0 commit comments

Comments
 (0)