From a87e11dc4dace20962a88e8fb081d58ad15db457 Mon Sep 17 00:00:00 2001 From: wenxin-jiang Date: Wed, 8 Apr 2026 18:03:06 -0400 Subject: [PATCH] fix: tolerate already-published npm packages in release workflow When a release run partially succeeds (some platform packages publish but a later one fails), re-running the workflow would fail immediately on the first already-published package. Now checks if the version is already on the registry and skips it instead of failing. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e917b6a..8f12316 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -294,7 +294,13 @@ jobs: run: | for pkg_dir in npm/socket-patch-*/; do echo "Publishing ${pkg_dir}..." - npm publish "./${pkg_dir}" --provenance --access public + npm publish "./${pkg_dir}" --provenance --access public || { + if npm view "@socketsecurity/$(basename "$pkg_dir")@${{ needs.version.outputs.version }}" version >/dev/null 2>&1; then + echo "Already published, skipping." + else + exit 1 + fi + } done - name: Wait for npm registry propagation @@ -304,7 +310,14 @@ jobs: run: cp README.md npm/socket-patch/README.md - name: Publish main package - run: npm publish ./npm/socket-patch --provenance --access public + run: | + npm publish ./npm/socket-patch --provenance --access public || { + if npm view "@socketsecurity/socket-patch@${{ needs.version.outputs.version }}" version >/dev/null 2>&1; then + echo "Already published, skipping." + else + exit 1 + fi + } pypi-publish: needs: [version, build]