Skip to content

Commit 495902e

Browse files
committed
ci(release): force HTTP/1.1 and make crates.io publish idempotent
Signed-off-by: Cong Wang <cwang@multikernel.io>
1 parent 131efd5 commit 495902e

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,34 @@ jobs:
177177
- name: Publish crates
178178
env:
179179
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
180-
# Order matters: dependents publish after their dependencies. core
181-
# goes first; oci depends on core, so it follows.
180+
# Force HTTP/1.1. crates.io intermittently returns "[16] Error in the
181+
# HTTP2 framing layer" during cargo's post-upload index poll, which
182+
# aborts the publish mid-sequence and leaves a partial release.
183+
CARGO_HTTP_MULTIPLEXING: "false"
184+
# Order matters: dependents publish after their dependencies. core goes
185+
# first; ffi/cli/oci depend on core, so they follow. Each publish
186+
# tolerates an already-uploaded version, so a transient flake (or a
187+
# re-run after one) skips the crates that already landed instead of
188+
# failing the whole job.
182189
run: |
183-
cargo publish -p sandlock-core
184-
cargo publish -p sandlock-ffi
185-
cargo publish -p sandlock-cli
186-
cargo publish -p sandlock-oci
190+
set -euo pipefail
191+
publish() {
192+
local crate="$1" out
193+
if out=$(cargo publish -p "$crate" 2>&1); then
194+
echo "$out"
195+
return 0
196+
fi
197+
echo "$out"
198+
if echo "$out" | grep -qiE 'already (uploaded|exists)|is already uploaded'; then
199+
echo "::notice::$crate is already published at this version; skipping"
200+
return 0
201+
fi
202+
return 1
203+
}
204+
publish sandlock-core
205+
publish sandlock-ffi
206+
publish sandlock-cli
207+
publish sandlock-oci
187208
188209
# Publish Python package to PyPI
189210
publish-pypi:

0 commit comments

Comments
 (0)