|
93 | 93 | fi |
94 | 94 | echo "Tag/version match: $ws_ver" |
95 | 95 |
|
| 96 | + - name: Check crates.io token is present |
| 97 | + # Fail fast - before the ~4.5 min verified dry-run - when the repo secret |
| 98 | + # `CRATES_IO_TOKEN` is missing/empty. Otherwise cargo publish fails only |
| 99 | + # after verification with an opaque auth error. |
| 100 | + run: | |
| 101 | + if [ -z "${CARGO_REGISTRY_TOKEN:-}" ]; then |
| 102 | + echo "CRATES_IO_TOKEN repo secret is not set (or is empty) - add a crates.io API token at GitHub repo Settings -> Secrets and variables -> Actions." >&2 |
| 103 | + exit 1 |
| 104 | + fi |
| 105 | + echo "crates.io token present" |
| 106 | +
|
96 | 107 | - name: Pre-publish verification (full verify, all members) |
97 | 108 | # Release policy: never publish without verify. `cargo publish |
98 | 109 | # --workspace --dry-run` packages every publishable member and |
@@ -145,7 +156,10 @@ jobs: |
145 | 156 | if cargo publish --workspace --allow-dirty "${excludes[@]}" >>"$log" 2>&1; then |
146 | 157 | echo "=== publish complete at $ver ==="; exit 0 |
147 | 158 | fi |
148 | | - ra=$(grep -o 'try again after [A-Za-z]*, [0-9]* [A-Za-z]* [0-9]* [0-9:]* GMT' "$log" | tail -n 1 | sed 's/try again after //') |
| 159 | + # `|| true` matters: the loop runs under `bash -e`, and a missing 429 |
| 160 | + # in the log makes this assignment exit 1 — silently skipping the |
| 161 | + # diagnostic + log tail below. Keep the no-match case non-fatal. |
| 162 | + ra=$(grep -o 'try again after [A-Za-z]*, [0-9]* [A-Za-z]* [0-9]* [0-9:]* GMT' "$log" | tail -n 1 | sed 's/try again after //' || true) |
149 | 163 | if [ -n "$ra" ]; then |
150 | 164 | ra_epoch=$(date -d "$ra" +%s) || { echo "::error::unparseable retry-after: $ra"; exit 1; } |
151 | 165 | sleep_s=$(( ra_epoch - $(date +%s) + 120 )) |
|
0 commit comments