@@ -90,24 +90,29 @@ jobs:
9090 if : ${{ contains(github.ref, 'refs/heads/release/') }}
9191 uses : rust-lang/crates-io-auth-action@v1
9292 id : crates-io-auth
93- - name : Install cargo-overlay-registry
94- if : ${{ contains(github.ref, 'refs/heads/release/') }}
95- run : cargo install cargo-overlay-registry
96- shell : bash
93+
9794 - name : Publish to crates.io
9895 if : ${{ contains(github.ref, 'refs/heads/release/') }}
9996 run : |
10097 set -euxo pipefail
101- rm -Rf ./target/package/tmp-registry
102- cargo overlay-registry \
103- -r crates-io \
104- -r local=./target/package/tmp-registry \
105- -- \
106- cargo +1.92 publish \
107- -p hyperlight-wasm-aot \
108- -p hyperlight-wasm-macro \
109- -p hyperlight-wasm-runtime \
110- -p hyperlight-wasm
98+
99+ publish_if_needed() {
100+ local crate=$1
101+ local version=$HYPERLIGHTWASM_VERSION
102+ local status_code
103+ status_code=$(curl -s -o /dev/null -w "%{http_code}" "https://crates.io/api/v1/crates/$crate/$version")
104+ if [ "$status_code" = "200" ]; then
105+ echo "✅ $crate@$version already published, skipping."
106+ else
107+ echo "🚀 Publishing $crate@$version"
108+ cargo +1.92 publish -p "$crate"
109+ fi
110+ }
111+
112+ publish_if_needed hyperlight-wasm-macro
113+ publish_if_needed hyperlight-wasm-runtime
114+ publish_if_needed hyperlight-wasm-aot
115+ publish_if_needed hyperlight-wasm
111116 env :
112117 CARGO_REGISTRY_TOKEN : ${{ steps.crates-io-auth.outputs.token }}
113118 shell : bash
0 commit comments