chore: satisfy CI fmt/clippy gates; make the release publish step idempotent
Docker / publish (push) Canceled after 0s
Release / crates-io (push) Canceled after 0s
Release / release (macos-14, aarch64-apple-darwin) (push) Canceled after 0s
Release / release (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Canceled after 0s
Release / release (windows-latest, x86_64-pc-windows-msvc) (push) Canceled after 0s

`cargo fmt --all -- --check` and `cargo clippy --all-targets -- -D warnings` are
CI gates and both were failing on this release's code.

- rustfmt across the files touched by the release
- `.split('/').last()` walks the whole iterator on a DoubleEndedIterator; use
  `.next_back()` (4 sites in the setup/featured + delete handlers)
- `set_progress` had two identical branches; the intent is "take the first
  reading, then only move forward", which is one condition

release.yml published unconditionally on a version tag, so a version already on
crates.io (released by hand, or a re-run of the job) failed the workflow — a
version can never be re-uploaded. It now checks the registry and skips instead.
This commit is contained in:
infosave2007
2026-08-06 18:18:21 +03:00
parent 9ec8861464
commit 32ce2f7ed7
5 changed files with 193 additions and 49 deletions
+12 -1
View File
@@ -21,9 +21,20 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Skip when this version is already on crates.io — a version can never be
# re-uploaded, so publishing one that exists (released by hand, or a re-run
# of this job) is a guaranteed failure rather than a real problem.
- name: Publish to crates.io
if: ${{ env.CARGO_REGISTRY_TOKEN != '' }}
run: cargo publish
run: |
name=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
if curl -sf -H 'User-Agent: cortiq-gateway-release' \
"https://crates.io/api/v1/crates/$name/$version" >/dev/null; then
echo "$name $version is already published — skipping"
else
cargo publish
fi
# --- prebuilt binaries + GitHub Release -----------------------------------
release: