From 683d39d6f5c00cf55fe291cc8a8964c505fdf913 Mon Sep 17 00:00:00 2001 From: gaspb Date: Thu, 2 Jul 2026 19:07:26 +0000 Subject: [PATCH 1/2] feat: add utoipa-axum and utoipa-scalar to the published crates --- Cargo.toml | 8 ++++++-- RELEASING.md | 27 +++++++++++++++++---------- utoipa-axum/Cargo.toml | 12 +++++++++--- utoipa-scalar/Cargo.toml | 13 +++++++++---- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 48ea9c83..5708cf5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,11 +17,15 @@ members = [ ] # Crates published to crates.io under the meteroid-oss fork, in dependency order. -# Only these three carry the fork's custom features (e.g. `tagged_discriminator`); -# the remaining workspace members are kept building locally but are not published. +# The core three (`-config`, `-gen`, `meteroid-utoipa`) carry the fork's custom +# features (e.g. `tagged_discriminator`); `-axum` and `-scalar` are the framework +# bindings consumed downstream. The remaining workspace members are kept building +# locally but are not published. [workspace.metadata.publish] order = [ "meteroid-utoipa-config", "meteroid-utoipa-gen", "meteroid-utoipa", + "meteroid-utoipa-axum", + "meteroid-utoipa-scalar", ] diff --git a/RELEASING.md b/RELEASING.md index 2b8090ca..f405dd87 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,16 +1,18 @@ # Releasing (meteroid-oss fork) -This fork publishes three crates to crates.io, in dependency order: +This fork publishes five crates to crates.io, in dependency order: | crates.io name | path | import as (unchanged) | version | | ------------------------ | ---------------- | --------------------- | ------- | | `meteroid-utoipa-config` | `utoipa-config/` | `utoipa_config` | 0.1.2 | | `meteroid-utoipa-gen` | `utoipa-gen/` | `utoipa_gen` | 5.6.0 | | `meteroid-utoipa` | `utoipa/` | `utoipa` | 5.6.0 | +| `meteroid-utoipa-axum` | `utoipa-axum/` | `utoipa_axum` | 0.2.0 | +| `meteroid-utoipa-scalar` | `utoipa-scalar/` | `utoipa_scalar` | 0.3.0 | The crates.io **package** names are prefixed with `meteroid-`, but the **library** -names are kept (`utoipa`, `utoipa_gen`, `utoipa_config`). Downstream code therefore -stays a drop-in with upstream: +names are kept (`utoipa`, `utoipa_gen`, `utoipa_config`, `utoipa_axum`, +`utoipa_scalar`). Downstream code therefore stays a drop-in with upstream: ```toml [dependencies] @@ -21,14 +23,15 @@ meteroid-utoipa = "5" use utoipa::ToSchema; // still `utoipa::...` ``` -The other workspace crates (`utoipa-swagger-ui`, `utoipa-axum`, ...) are **not** -published from this fork; they only build locally against the renamed core. +The other workspace crates (`utoipa-swagger-ui`, `utoipa-redoc`, `utoipa-rapidoc`, +`utoipa-actix-web`, ...) are **not** published from this fork; they only build +locally against the renamed core. ## One-time setup Add a repository secret `CARGO_REGISTRY_TOKEN` (Settings → Secrets and variables → Actions) — a crates.io API token with publish scope from -crates.io → Account Settings → API Tokens. The three crate names must be owned by +crates.io → Account Settings → API Tokens. The five crate names must be owned by the token's account (the first publish claims them). ## Cutting a release @@ -62,16 +65,17 @@ you probably forgot to bump the `Cargo.toml` version(s). ## Which tag do I pick? -The three crates have different versions, but you only pick **one** tag, and it's +The crates have different versions, but you only pick **one** tag, and it's just a trigger — it does not decide what gets published (that comes from each crate's `Cargo.toml`). Use the **`meteroid-utoipa` version**, e.g. `v5.6.0`. That is the crate you and downstream depend on, so the release *is* "meteroid-utoipa -5.6.0". The other two ride along automatically: +5.6.0". The others ride along automatically: - `meteroid-utoipa-gen` moves **in lockstep** with `meteroid-utoipa` (same number — the derive-macro crate and its runtime are a matched pair), so it is covered. -- `meteroid-utoipa-config` is independent and rarely changes; whenever you bump its - own `Cargo.toml`, it publishes on the next release regardless of the tag. +- `meteroid-utoipa-config`, `meteroid-utoipa-axum` and `meteroid-utoipa-scalar` are + independent and rarely change; whenever you bump one's own `Cargo.toml`, it + publishes on the next release regardless of the tag. The workflow emits a warning if the release tag's version doesn't match the `meteroid-utoipa` version, to catch a forgotten bump. @@ -87,6 +91,9 @@ juhaku/utoipa): by two opt-in, backward-compatible features (`tagged_discriminator` and flatten support in `IntoParams`), hence the minor bump to **5.6.0**. - `meteroid-utoipa-config` is unchanged from upstream, so it stays at **0.1.2**. +- `meteroid-utoipa-axum` (**0.2.0**) and `meteroid-utoipa-scalar` (**0.3.0**) are + the framework bindings, unchanged from upstream; they only depend on the renamed + core. Bump them when their own `Cargo.toml` changes. Keep `meteroid-utoipa` and `meteroid-utoipa-gen` on the same version. When you rebase onto a newer upstream release, jump to match it (e.g. upstream 5.7.0 → diff --git a/utoipa-axum/Cargo.toml b/utoipa-axum/Cargo.toml index 88e937ec..11589535 100644 --- a/utoipa-axum/Cargo.toml +++ b/utoipa-axum/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "utoipa-axum" -description = "Utoipa's axum bindings for seamless integration for the two" +name = "meteroid-utoipa-axum" +description = "Utoipa's axum bindings for seamless integration for the two (meteroid-oss fork of utoipa-axum)" version = "0.2.0" edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" keywords = ["utoipa", "axum", "bindings"] -repository = "https://github.com/juhaku/utoipa" +repository = "https://github.com/meteroid-oss/utoipa" categories = ["web-programming"] authors = ["Juha Kukkonen "] rust-version.workspace = true @@ -18,6 +18,12 @@ include = [ "CHANGELOG.md", "Cargo.toml", ] + +# Published as `meteroid-utoipa-axum` but keeps the `utoipa_axum` lib name so +# downstream code stays `use utoipa_axum::...` as a drop-in with upstream. +[lib] +name = "utoipa_axum" + [features] debug = [] diff --git a/utoipa-scalar/Cargo.toml b/utoipa-scalar/Cargo.toml index d969430d..c06fb5c4 100644 --- a/utoipa-scalar/Cargo.toml +++ b/utoipa-scalar/Cargo.toml @@ -1,16 +1,21 @@ [package] -name = "utoipa-scalar" -description = "Scalar for utoipa" +name = "meteroid-utoipa-scalar" +description = "Scalar for utoipa (meteroid-oss fork of utoipa-scalar)" version = "0.3.0" edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" keywords = ["scalar", "openapi", "documentation"] -repository = "https://github.com/juhaku/utoipa" +repository = "https://github.com/meteroid-oss/utoipa" categories = ["web-programming"] authors = ["Juha Kukkonen "] rust-version.workspace = true +# Published as `meteroid-utoipa-scalar` but keeps the `utoipa_scalar` lib name so +# downstream code stays `use utoipa_scalar::...` as a drop-in with upstream. +[lib] +name = "utoipa_scalar" + [package.metadata.docs.rs] features = ["actix-web", "axum", "rocket"] rustdoc-args = ["--cfg", "doc_cfg"] @@ -26,7 +31,7 @@ rocket = { version = "0.5", features = ["json"], optional = true } axum = { version = "0.8.4", default-features = false, optional = true } [dev-dependencies] -utoipa-scalar = { path = ".", features = ["actix-web", "axum", "rocket"] } +utoipa-scalar = { package = "meteroid-utoipa-scalar", path = ".", features = ["actix-web", "axum", "rocket"] } [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] } From 1ee2ffb4dff3c4c63a4f7daa79592f8e64380c5d Mon Sep 17 00:00:00 2001 From: gaspb Date: Thu, 2 Jul 2026 19:21:25 +0000 Subject: [PATCH 2/2] fix: skip already-published versions reliably in publish-crates workflow --- .github/workflows/publish-crates.yaml | 40 +++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-crates.yaml b/.github/workflows/publish-crates.yaml index e489f306..03da98fa 100644 --- a/.github/workflows/publish-crates.yaml +++ b/.github/workflows/publish-crates.yaml @@ -77,15 +77,23 @@ jobs: fi fi + # Returns 0 if $1@$2 is already on the crates.io sparse index. We query the + # index (what cargo itself resolves against) rather than the web API, which + # can rate-limit or reject on User-Agent policy and give a false "missing" + # that makes us try to re-publish an existing version. + is_published() { + local name="$1" ver="$2" prefix="${1:0:2}/${1:2:2}" + curl -sSf "https://index.crates.io/${prefix}/${name}" 2>/dev/null \ + | grep -qF "\"vers\":\"${ver}\"" + } + published=0 for crate in $publish_order; do version=$(jq -r --arg n "$crate" '.packages[] | select(.name == $n) | .version' <<<"$metadata") echo "::group::$crate v$version" - # Idempotent: skip versions already live on crates.io. - code=$(curl -sS -o /dev/null -w '%{http_code}' \ - "https://crates.io/api/v1/crates/${crate}/${version}" || echo "000") - if [[ "$code" == "200" ]]; then + # Idempotent fast-path: skip versions already live on the index. + if is_published "$crate" "$version"; then echo "$crate $version is already published, skipping." echo "- \`$crate\` \`$version\` — already published (skipped)" >> "$GITHUB_STEP_SUMMARY" echo "::endgroup::" @@ -96,10 +104,23 @@ jobs: [[ "$DRY_RUN" == "true" ]] && flags+=(--dry-run) # cargo (>=1.66) blocks until the crate is queryable in the index, so the - # next dependent crate can resolve it. Retry to ride out transient hiccups. + # next dependent crate can resolve it. Retry to ride out transient hiccups, + # but treat "already published" as success: re-publishing a version is never + # retryable, and the pre-check can race a concurrent or just-finished publish. attempt=1 max=5 - until cargo publish "${flags[@]}"; do + skipped="" + while true; do + if out=$(cargo publish "${flags[@]}" 2>&1); then + printf '%s\n' "$out" + break + fi + printf '%s\n' "$out" + if grep -qiE "already (exists|uploaded)" <<<"$out"; then + echo "$crate $version is already published, skipping." + skipped=1 + break + fi if [[ $attempt -ge $max ]]; then echo "::error::Failed to publish $crate after $max attempts." exit 1 @@ -110,12 +131,15 @@ jobs: attempt=$((attempt + 1)) done - if [[ "$DRY_RUN" == "true" ]]; then + if [[ -n "$skipped" ]]; then + echo "- \`$crate\` \`$version\` — already published (skipped)" >> "$GITHUB_STEP_SUMMARY" + elif [[ "$DRY_RUN" == "true" ]]; then echo "- \`$crate\` \`$version\` — dry-run OK" >> "$GITHUB_STEP_SUMMARY" + published=$((published + 1)) else echo "- \`$crate\` \`$version\` — published" >> "$GITHUB_STEP_SUMMARY" + published=$((published + 1)) fi - published=$((published + 1)) echo "::endgroup::" done