Skip to content

Commit 744475d

Browse files
authored
fix releasing (#17)
* Create update-jsr.mjs * Update npm-publish.yml * Delete .github/scripts/update-jsr.mjs
1 parent 5d8d662 commit 744475d

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

.github/workflows/npm-publish.yml

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3-
4-
name: Node.js Package
1+
name: Publish package to registries
52

63
on:
7-
workflow_dispatch:
84
release:
95
types: [created]
106

7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
1116
jobs:
12-
publish-npm:
17+
deploy:
1318
runs-on: ubuntu-latest
1419
steps:
1520
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
1723
with:
18-
node-version: 21
19-
registry-url: https://registry.npmjs.org/
24+
node-version: 21.x
25+
registry-url: "https://registry.npmjs.org"
26+
cache: "npm"
2027
- run: npm ci
21-
- run: npm run build
28+
- run: npm run build --if-present
29+
- run: |
30+
cp jsr.json jsr.json.old
31+
jq ".version = \"${TAG_NAME}\"" jsr.json.old > jsr.json
32+
rm jsr.json.old
33+
env:
34+
TAG_NAME: ${{ github.event.release.tag_name }}
35+
- run: npx jsr publish --allow-dirty --allow-slow-types
36+
- run: npm version ${TAG_NAME} --git-tag-version=false
37+
env:
38+
TAG_NAME: ${{ github.event.release.tag_name }}
2239
- run: npm publish
2340
env:
24-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
25-
26-
publish-jsr:
27-
runs-on: ubuntu-latest
28-
29-
permissions:
30-
contents: read
31-
id-token: write
32-
33-
steps:
34-
- uses: actions/checkout@v4
35-
- uses: actions/setup-node@v4
36-
with:
37-
node-version: 21
38-
registry-url: https://registry.npmjs.org/
39-
- run: npm ci
40-
- run: npm run build
41-
- run: npx jsr publish
41+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

0 commit comments

Comments
 (0)