Skip to content

Commit 2e3d2c2

Browse files
committed
fix: publish via npm CLI with provenance (pnpm publish path fails with E404); drop debug workflow
1 parent 5d65235 commit 2e3d2c2

3 files changed

Lines changed: 26 additions & 32 deletions

File tree

.github/workflows/debug-npm-auth.yml

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"nuke": "rimraf node_modules packages/*/node_modules examples/*/node_modules",
1414
"changeset": "changeset",
1515
"version-packages": "changeset version",
16-
"release": "pnpm -r --sort build && changeset publish"
16+
"release": "bash scripts/release.sh"
1717
},
1818
"devDependencies": {
1919
"@typescript-eslint/eslint-plugin": "^8.18.2",

scripts/release.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
# Publish all unpublished public packages to npm with provenance.
3+
# Used instead of `changeset publish` because pnpm's publish path fails
4+
# provenance verification with a misleading E404 (npm CLI works fine).
5+
set -euo pipefail
6+
7+
pnpm -r --sort build
8+
9+
for pkg in packages/*/; do
10+
manifest="$pkg/package.json"
11+
[ -f "$manifest" ] || continue
12+
private=$(node -p "require('./$manifest').private ?? false")
13+
[ "$private" = "true" ] && continue
14+
15+
name=$(node -p "require('./$manifest').name")
16+
version=$(node -p "require('./$manifest').version")
17+
published=$(npm view "${name}@${version}" version --registry=https://registry.npmjs.org 2>/dev/null || true)
18+
19+
if [ "$published" = "$version" ]; then
20+
echo "${name}@${version} already published, skipping"
21+
else
22+
echo "🚀 Publishing ${name}@${version}"
23+
(cd "$pkg" && npm publish --registry=https://registry.npmjs.org --access public --provenance)
24+
fi
25+
done

0 commit comments

Comments
 (0)