Skip to content

Commit 94f92a4

Browse files
fix: patch semantic-release for Trusted Publishers
See (Claude's) comment in pnpm-workspace.yaml for the gnarly details.
1 parent 114f305 commit 94f92a4

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/lib/publish.js b/lib/publish.js
2+
index ac3e6feea8e388d88e77d58538a265f7ab4eac05..3af1b9ff1859dfa463398d9d97fd4c26f37c270c 100644
3+
--- a/lib/publish.js
4+
+++ b/lib/publish.js
5+
@@ -22,8 +22,8 @@ export default async function (npmrc, { npmPublish, pkgRoot }, pkg, context) {
6+
logger.log(`Publishing version ${version} to npm registry on dist-tag ${distTag}`);
7+
const result = execa(
8+
"npm",
9+
- ["publish", basePath, "--userconfig", npmrc, "--tag", distTag, "--registry", registry],
10+
- { cwd, env, preferLocal: true }
11+
+ ["publish", "--userconfig", npmrc, "--tag", distTag, "--registry", registry],
12+
+ { cwd: basePath, env, preferLocal: true }
13+
);
14+
result.stdout.pipe(stdout, { end: false });
15+
result.stderr.pipe(stderr, { end: false });

pnpm-lock.yaml

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
packages:
2-
- "docs"
3-
- "next-cloudinary"
2+
- docs
3+
- next-cloudinary
4+
patchedDependencies:
5+
# Works around a semantic-release/npm bug: `publish.js` runs `npm publish <pkgRoot>`
6+
# with cwd left at the repo root instead of <pkgRoot>. That mismatch silently breaks
7+
# npm's OIDC/trusted-publishing auto-detection (it fails closed with a plain
8+
# ENEEDAUTH/"npm adduser" error, no OIDC-related message at all), which is what we hit
9+
# switching this repo to Trusted Publishers.
10+
# Bug: https://github.com/semantic-release/npm/issues/504
11+
# Unmerged fix: https://github.com/semantic-release/npm/pull/531
12+
#
13+
# Once a released @semantic-release/npm version includes that fix (or an equivalent
14+
# one - check publish.js runs `npm publish` with `cwd` already set to the resolved
15+
# pkgRoot path), do all of:
16+
# 1. Bump the "@semantic-release/npm" version in package.json to that release.
17+
# 2. Delete this patchedDependencies entry and patches/@semantic-release__npm@13.1.5.patch.
18+
# 3. Run `pnpm install`.
19+
# Step 1 without steps 2-3 will make `pnpm install` fail outright (pnpm errors if a
20+
# patchedDependencies entry doesn't match an installed version) - that failure is the
21+
# signal to finish the cleanup, not a sign anything else is wrong.
22+
'@semantic-release/npm@13.1.5': patches/@semantic-release__npm@13.1.5.patch

0 commit comments

Comments
 (0)