Skip to content

Commit a2221b5

Browse files
committed
Fix temp file leak and add npm provenance in GitHub Actions
- Clean up temp file on jq/mv failure for wrapper package.json update, consistent with the platform loop - Pass --provenance to npm publish when running in GitHub Actions
1 parent 9fa3c32 commit a2221b5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/npm-publish.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ -z "$VERSION" ]; then
77
exit 1
88
fi
99

10-
# When called from goreleaser, $2 is "true" if snapshot build
10+
# When called from goreleaser, $2 is "--dry-run" if snapshot build
1111
DRY_RUN=false
1212
if [ "$2" = "true" ] || [ "$2" = "--dry-run" ]; then
1313
echo "Running in DRY-RUN mode. Packages will be created but not published."
@@ -41,7 +41,7 @@ done < <(find npm -name package.json)
4141
# Also update the optionalDependencies version references in the wrapper
4242
tmp="$(mktemp)"
4343
jq --arg v "$VERSION" '.optionalDependencies = (.optionalDependencies | with_entries(.value = $v))' \
44-
npm/wrapper/package.json > "$tmp" && mv "$tmp" npm/wrapper/package.json
44+
npm/wrapper/package.json > "$tmp" && mv "$tmp" npm/wrapper/package.json || { rm -f "$tmp"; exit 1; }
4545

4646
# Build ordered package list: platform packages first, wrapper last
4747
PACKAGES=()

0 commit comments

Comments
 (0)