Skip to content

Commit b2371c7

Browse files
committed
Make JSR publishing tolerate timeouts
JSR publishes can time out even though repeated attempts eventually finish. Run deno publish with a short per-attempt timeout and retry up to 30 times, letting deno publish handle already published workspace packages on later attempts. Assisted-by: Codex:gpt-5.5
1 parent f4ac38d commit b2371c7

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/main.yaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
if: github.event_name == 'push'
5151
needs: [test]
5252
runs-on: ubuntu-latest
53+
timeout-minutes: 60
5354
permissions:
5455
contents: write
5556
id-token: write
@@ -89,7 +90,37 @@ jobs:
8990
fi
9091
env:
9192
NPM_CONFIG_PROVENANCE: "true"
92-
- run: deno publish --allow-dirty
93+
- run: |
94+
set -euo pipefail
95+
96+
max_attempts=30
97+
timeout_seconds=60
98+
99+
for attempt in $(seq 1 "$max_attempts"); do
100+
echo "Publishing to JSR (attempt $attempt/$max_attempts)..."
101+
102+
set +e
103+
timeout --foreground "${timeout_seconds}s" deno publish --allow-dirty
104+
status=$?
105+
set -e
106+
107+
if [[ "$status" -eq 0 ]]; then
108+
exit 0
109+
fi
110+
111+
if [[ "$attempt" -eq "$max_attempts" ]]; then
112+
echo "deno publish failed after $max_attempts attempts."
113+
exit "$status"
114+
fi
115+
116+
if [[ "$status" -eq 124 ]]; then
117+
echo "deno publish timed out after ${timeout_seconds}s; retrying."
118+
else
119+
echo "deno publish failed with exit code $status; retrying."
120+
fi
121+
122+
sleep 5
123+
done
93124
- if: github.ref_type == 'tag'
94125
id: extract-changelog
95126
uses: dahlia/submark@ed8f47b4d51fda07e12b6e991641a8bd5ec62f8e

0 commit comments

Comments
 (0)