بنقرة واحدة
binary-releases
Cross-platform binary builds for GitHub Releases with cargo-binstall support
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Cross-platform binary builds for GitHub Releases with cargo-binstall support
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Choosing and profiling the global allocator (jemalloc, mimalloc, system) in the backend-service `service` template
Request lifecycle, Tower layer ordering, and scaling choices in the backend-service `service` template
Observability wiring for the backend-service `service` template: metrique wide-event metrics, tracing logs, and optional dial9 runtime profiling
Setting up automated crate releases with release-plz and OIDC trusted publishing
Standard GitHub Actions CI structure for Rust projects using ci-battery-pack
Propagating and formatting errors in Rust applications with anyhow
| name | binary-releases |
| description | Cross-platform binary builds for GitHub Releases with cargo-binstall support |
Cross-platform binary distribution via GitHub Releases, discoverable by cargo-binstall.
Add to an existing project:
cargo bp add ci -t binary-release
The build-binaries.yml workflow triggers on release: [published] events. When release-plz publishes a new version and creates a GitHub Release, this workflow builds binaries for each target platform and uploads them as release assets.
Users can then install your binary without compiling:
cargo binstall your-crate
The default matrix covers the most common targets:
| Target | Runner | Archive |
|---|---|---|
x86_64-unknown-linux-gnu | ubuntu-latest | .tar.gz |
aarch64-unknown-linux-gnu | ubuntu-24.04-arm | .tar.gz |
x86_64-apple-darwin | macos-latest | .tar.gz |
aarch64-apple-darwin | macos-latest | .tar.gz |
x86_64-pc-windows-msvc | windows-latest | .zip |
To add or remove targets, edit the matrix.include array in build-binaries.yml.
The template adds a [package.metadata.binstall] section to your Cargo.toml:
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/{ name }-v{ version }/{ name }-{ target }-v{ version }{ archive-suffix }"
This tells cargo-binstall where to find pre-built binaries. The URL pattern must match the archive naming convention used in the workflow's packaging steps.
cargo bp add ci -t binary-release to generate the workflow and Cargo.toml metadata[[bin]] and [package.metadata.binstall] in Cargo.tomlThe PAT and secret setup requires GitHub web UI access. Instruct the user to complete:
contents: write and pull-requests: write for the target repoRELEASE_PLZ_TOKEN repository secretbinary_release is enabledSee the trusted-publishing skill for the full release pipeline setup.
This workflow requires a RELEASE_PLZ_TOKEN PAT (not just GITHUB_TOKEN). Events created by GITHUB_TOKEN do not trigger other workflows. Since release-plz creates the GitHub Release, and this workflow triggers on that release event, the release must be created with a PAT for the event to propagate.
The workflow extracts the version from the release tag name. Release-plz uses tags like my-crate-v0.1.0 for workspace crates or v0.1.0 for single-crate repos. The extraction step strips the package name prefix:
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG##*-v}"
This produces archive names like my-crate-x86_64-unknown-linux-gnu-v0.1.0.tar.gz.
Your crate needs a [[bin]] section:
[[bin]]
name = "my-tool"
path = "src/main.rs"
The template generates a placeholder src/main.rs if one doesn't exist. The -p flag in the build command (cargo build --release --target ${{ matrix.target }} -p my-crate) targets the specific package in a workspace.
Binary releases sit downstream of the release pipeline:
release.yml (release-plz) publishes to crates.io and creates a GitHub Releasebuild-binaries.ymlIf you only need crate publishing (no pre-built binaries), use cargo bp add ci -t trusted-publishing alone. The binary-release template is an add-on that requires trusted-publishing to be configured first.