Skip to content

Commit 70710b1

Browse files
Wenxin-Jiangclaude
andauthored
fix: tolerate already-published npm packages in release workflow (#61)
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) <noreply@anthropic.com>
1 parent 06e922a commit 70710b1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,13 @@ jobs:
294294
run: |
295295
for pkg_dir in npm/socket-patch-*/; do
296296
echo "Publishing ${pkg_dir}..."
297-
npm publish "./${pkg_dir}" --provenance --access public
297+
npm publish "./${pkg_dir}" --provenance --access public || {
298+
if npm view "@socketsecurity/$(basename "$pkg_dir")@${{ needs.version.outputs.version }}" version >/dev/null 2>&1; then
299+
echo "Already published, skipping."
300+
else
301+
exit 1
302+
fi
303+
}
298304
done
299305
300306
- name: Wait for npm registry propagation
@@ -304,7 +310,14 @@ jobs:
304310
run: cp README.md npm/socket-patch/README.md
305311

306312
- name: Publish main package
307-
run: npm publish ./npm/socket-patch --provenance --access public
313+
run: |
314+
npm publish ./npm/socket-patch --provenance --access public || {
315+
if npm view "@socketsecurity/socket-patch@${{ needs.version.outputs.version }}" version >/dev/null 2>&1; then
316+
echo "Already published, skipping."
317+
else
318+
exit 1
319+
fi
320+
}
308321
309322
pypi-publish:
310323
needs: [version, build]

0 commit comments

Comments
 (0)