Skip to content

Commit b0136b6

Browse files
committed
Use separate action for publishing to JSR
1 parent 5ff4935 commit b0136b6

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

.github/workflows/publish-jsr.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
push:
3+
tags:
4+
- 'multipart-parser@[0-9]+.[0-9]+.[0-9]+'
5+
- 'scripts-test@[0-9]+.[0-9]+.[0-9]+'
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: read
13+
id-token: write # The OIDC ID token is used for authentication with JSR.
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Install Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
24+
- name: Publish
25+
run: npx jsr publish

.github/workflows/release.yaml .github/workflows/publish.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ jobs:
99
release:
1010
runs-on: ubuntu-latest
1111

12-
permissions:
13-
contents: read
14-
id-token: write # The OIDC ID token is used for authentication with JSR.
15-
1612
steps:
1713
- name: Checkout
1814
uses: actions/checkout@v4
@@ -32,8 +28,7 @@ jobs:
3228
- name: Install dependencies
3329
run: pnpm install
3430

35-
- name: Release
31+
- name: Publish
3632
run: pnpm publish-release-ci ${{ github.ref_name }}
3733
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3934
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

scripts/publish-release.js

+2-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as cp from 'node:child_process';
22

33
import { createRelease } from './utils/github-releases.js';
4-
import { getPackageDir, hasJsrJson, readJsrJson, readPackageJson } from './utils/packages.js';
4+
import { getPackageDir, readPackageJson } from './utils/packages.js';
55
import { logAndExec } from './utils/process.js';
66
import { isValidVersion } from './utils/semver.js';
77

@@ -64,24 +64,7 @@ logAndExec(`npm publish --access public`, {
6464
});
6565
console.log();
6666

67-
// 4) Publish to jsr (if applicable)
68-
if (hasJsrJson(packageName)) {
69-
let jsrJson = readJsrJson(packageName);
70-
if (jsrJson.version !== version) {
71-
console.error(
72-
`Tag does not match jsr.json version: ${version} !== ${jsrJson.version} (${tag})`,
73-
);
74-
process.exit(1);
75-
}
76-
77-
logAndExec(`pnpm dlx jsr publish`, {
78-
cwd: getPackageDir(packageName),
79-
env: process.env,
80-
});
81-
console.log();
82-
}
83-
84-
// 5) Publish to GitHub Releases
67+
// 4) Publish to GitHub Releases
8568
console.log(`Publishing ${tag} on GitHub Releases ...`);
8669
let releaseUrl = await createRelease(packageName, version);
8770
console.log(`Published at: ${releaseUrl}`);

0 commit comments

Comments
 (0)