Forráskód Böngészése

fix(release): use npm publish for OIDC trusted publishing (#283)

* prepare v0.19.0

Bump all @json-render/* packages to 0.19.0, add changelog entry for
custom directives API and @json-render/directives package, and update
the web app changelog page.

* fix(release): use npm publish for OIDC trusted publishing

pnpm publish does not pass through OIDC credentials, causing E404 on
npm. Switch to pnpm pack + npm publish per package, matching the
pattern used in wterm.
Chris Tate 2 hónapja
szülő
commit
705e9fcbb7
1 módosított fájl, 28 hozzáadás és 1 törlés
  1. 28 1
      .github/workflows/release.yml

+ 28 - 1
.github/workflows/release.yml

@@ -87,7 +87,34 @@ jobs:
         run: pnpm run build
 
       - name: Publish all public packages
-        run: pnpm -r publish --provenance --no-git-checks --access public --filter '@json-render/*'
+        run: |
+          LOCAL_VERSION="${{ needs.check-release.outputs.version }}"
+          FAILED=""
+
+          publish_pkg() {
+            local dir="$1" name="$2"
+            REGISTRY_VERSION=$(npm view "$name" version 2>/dev/null || echo "0.0.0")
+            if [ "$LOCAL_VERSION" = "$REGISTRY_VERSION" ]; then
+              echo "$name@$LOCAL_VERSION already published, skipping"
+              return 0
+            fi
+            echo "Publishing $name@$LOCAL_VERSION..."
+            TARBALL=$(cd "$dir" && pnpm pack --pack-destination /tmp | tail -1)
+            if ! npm publish "$TARBALL" --provenance --access public; then
+              FAILED="$FAILED $name"
+            fi
+          }
+
+          for dir in packages/*/; do
+            PKG_NAME=$(node -p "try { const p = require('./$dir/package.json'); p.private ? '' : p.name } catch { '' }")
+            [ -z "$PKG_NAME" ] && continue
+            publish_pkg "$dir" "$PKG_NAME"
+          done
+
+          if [ -n "$FAILED" ]; then
+            echo "Failed to publish:$FAILED"
+            exit 1
+          fi
 
   github-release:
     name: Create GitHub Release