chore: release v0.2.2 #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: semver | |
| # Tripwire for an accidental SemVer break in the published library crate. | |
| # | |
| # The incident this closes (discord-desktop-core 0.1.0): a change added a variant | |
| # to a public enum that was not `#[non_exhaustive]` and a field to a public struct | |
| # — a BREAKING change — committed as `fix(...)`, which release-plz maps to a PATCH | |
| # bump. Nothing caught it; it surfaced only in human review. | |
| # | |
| # cargo-semver-checks classifies the change by comparing the working tree against | |
| # the version PUBLISHED on crates.io, and fails when the taken bump is smaller | |
| # than the change requires. On a 0.x line a breaking change requires a MINOR bump | |
| # (0.1 -> 0.2); cargo-semver-checks applies that Cargo rule itself. | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| semver: | |
| runs-on: ubuntu-latest | |
| env: | |
| # Published library crates, in dependency order. A crate with | |
| # `publish = false` (or a fuzz/bin-only target) never belongs here. | |
| PUBLISHED_CRATES: "blob-decoder" | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | |
| - name: Install nightly (cargo-semver-checks needs rustdoc JSON) | |
| run: rustup toolchain install nightly --profile minimal | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - uses: taiki-e/install-action@a402910a723481c4c80d006d75298c796a9c8695 # cargo-semver-checks | |
| with: | |
| tool: cargo-semver-checks | |
| - name: Check SemVer against the published baseline | |
| run: | | |
| # Sparse-index path for a crate name (crates.io layout). | |
| index_path() { | |
| local n="$1" | |
| case ${#n} in | |
| 1) printf '1/%s' "$n" ;; | |
| 2) printf '2/%s' "$n" ;; | |
| 3) printf '3/%s/%s' "${n:0:1}" "$n" ;; | |
| *) printf '%s/%s/%s' "${n:0:2}" "${n:2:2}" "$n" ;; | |
| esac | |
| } | |
| fail=0 | |
| for crate in $PUBLISHED_CRATES; do | |
| echo "::group::$crate" | |
| # An unpublished crate has no baseline to diff against. Say so loudly | |
| # and move on — never let "no baseline" read as "no breaking change". | |
| if ! curl -sSfL \ | |
| -H "User-Agent: blob-decoder-ci (albert@securityronin.com)" \ | |
| "https://index.crates.io/$(index_path "$crate")" -o /dev/null; then | |
| echo "::warning title=semver baseline missing::SKIPPED $crate — not published on crates.io, so cargo-semver-checks has no baseline. This crate is NOT semver-gated until its first publish." | |
| echo "SKIPPED $crate (not on crates.io — no baseline)" | |
| echo "::endgroup::" | |
| continue | |
| fi | |
| cargo semver-checks --all-features -p "$crate" || fail=1 | |
| echo "::endgroup::" | |
| done | |
| exit $fail |