Skip to content

Add a release workflow and cargo-binstall metadata - #159

Merged
Kinflou merged 3 commits into
mainfrom
ci/release-binstall
Nov 14, 2026
Merged

Kinflou merged 3 commits into
mainfrom
ci/release-binstall

Conversation

@Kinflou

@Kinflou Kinflou commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Adds .github/workflows/release.yml and [package.metadata.binstall] so a pushed v<version> tag produces a draft GitHub Release that cargo binstall --git https://github.com/ComlineProject/cli comline can install from. Nothing is released by this PR: no tag, no release.

Flow

  • v* tag push: verify the tag equals the Cargo.toml version (fails otherwise), build the matrix, smoke-test, attest, then one job runs gh release create --draft --verify-tag --generate-notes with the archives and SHA256SUMS. Tags containing - are marked prerelease. A human publishes the draft.
  • pull_request (only when release.yml, Cargo.toml or Cargo.lock change) and workflow_dispatch: build + package only; archives are uploaded as workflow artifacts (7 days). No attest, no release.
  • Smoke jobs (all modes, one per Linux arch): download the packaged archive, extract it, and prove it is static and runs on an old system (below).

Targets

target runner
x86_64-unknown-linux-musl ubuntu-24.04, in the ci-tools container
aarch64-unknown-linux-musl ubuntu-24.04-arm, in the ci-tools container
aarch64-apple-darwin macos-15
x86_64-apple-darwin macos-15 (target added)
x86_64-pc-windows-msvc windows-2025

Linux is static musl, so the binaries run on the oldest distributions rather than needing glibc 2.39. The Linux legs run inside ghcr.io/comlineproject/ci-tools@sha256:b9301f9c... (multi-arch; Rust stable, the musl target, musl-tools). The job installs the toolchain rust-toolchain.toml names (1.99.1) with the target, and sets CC_<target>=musl-gcc so wasmtime's cc-built C helpers compile against musl; musl targets link with crt-static by default. harden-runner does not run inside container jobs, so those legs have none (the macOS and Windows legs have none either). No apt.

The smoke jobs check the packaged archive on a plain runner: file reports static (statically linked on aarch64, static-pie linked on x86_64), ldd reports no dynamic executable, readelf shows no INTERP header and no NEEDED entries, and comline --version runs on the runner, in debian:9 (glibc 2.24) and in busybox:1.37.0-uclibc (no glibc), the images pinned by digest. It also fails if the embedded commit is unknown.

Archive layout and binstall

comline-<target>.tar.gz (.zip on Windows) containing comline-<target>/comline[.exe], LICENSE, README.md. Plus SHA256SUMS over all archives, and a build-provenance attestation per archive (actions/attest-build-provenance, in a separate job holding only id-token/attestations: write).

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }{ archive-suffix }"
bin-dir = "{ name }-{ target }/{ bin }{ binary-ext }"
pkg-fmt = "tgz"

[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"

{ archive-suffix } follows pkg-fmt, so the Windows override only changes the format. No override is needed for Linux: cargo-binstall's target detection (detect-targets) returns <arch>-unknown-linux-gnu first on a glibc host and <arch>-unknown-linux-musl as the fallback, so a gnu host finds no gnu archive and takes the musl one.

Conventions

All actions pinned to SHAs (existing org pins reused; upload-artifact v7.0.2, download-artifact v8.0.2 and attest-build-provenance v4.2.2 resolved from their release tags). Top-level contents: read; contents: write only on the release job; id-token/attestations: write only on the attest job. persist-credentials: false, timeout-minutes everywhere, harden-runner (audit) on the non-container Linux jobs (smoke, attest, release), pinned runner labels, toolchain read from rust-toolchain.toml (1.99.1), --locked --release.

Two choices to be aware of:

  • Swatinem/rust-cache is skipped on tag builds so a release never ships output from an earlier cache.

RELEASING.md gets a short paragraph on the tag-triggered draft release.

For you to decide

  • Signing: no minisign signature here (needs a secret key). It could be added as a .minisig per archive plus a signing block in the binstall metadata once a key exists. The attestations and SHA256SUMS are the integrity story for now.
  • Whether the release should stay a draft (it is, as requested), and whether the target/runner set is right.
  • The Attest and Draft release jobs only run on a tag, so they are untested until the first v* tag.

@Kinflou
Kinflou marked this pull request as ready for review November 14, 2026 18:27
@Kinflou
Kinflou merged commit 9104006 into main Nov 14, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant