Skip to content

Commit 8aedb0e

Browse files
committed
Try publishing from main publish script again
1 parent 70bd40b commit 8aedb0e

File tree

3 files changed

+24
-34
lines changed

3 files changed

+24
-34
lines changed

.github/workflows/publish-jsr.yaml

-32
This file was deleted.

.github/workflows/publish.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ 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+
1216
steps:
1317
- name: Checkout
1418
uses: actions/checkout@v4
@@ -31,4 +35,5 @@ jobs:
3135
- name: Publish
3236
run: pnpm publish-release-ci ${{ github.ref_name }}
3337
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3439
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

scripts/publish-release.js

+19-2
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, readPackageJson } from './utils/packages.js';
4+
import { getPackageDir, hasJsrJson, readJsrJson, readPackageJson } from './utils/packages.js';
55
import { logAndExec } from './utils/process.js';
66
import { isValidVersion } from './utils/semver.js';
77

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

67-
// 4) Publish to GitHub Releases
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
6885
console.log(`Publishing ${tag} on GitHub Releases ...`);
6986
let releaseUrl = await createRelease(packageName, version);
7087
console.log(`Published at: ${releaseUrl}`);

0 commit comments

Comments
 (0)