Lesson 8 of 9 · 24m
Distribution: cargo, GitHub Releases, Packages, and cargo-dist
Choose distribution channels based on user trust, update mechanics, checksums, signatures, package ownership, and rollback expectations.
Shipping a binary is easy. Shipping the same binary safely to thousands of machines, for years, through channels users already trust, is engineering. The channel determines who can update the artifact, how integrity is verified, how rollback works, and what happens when your release machine is compromised. Decide those properties before compressing a tarball.
Match the channel to the audience
cargo install Rust developers, source builds, fast iteration
GitHub Releases direct downloads, broad automation, explicit checksums
crates.io source distribution and versioning metadata
deb/rpm system administrators, package-manager lifecycle
Homebrew macOS and Linux developer convenience
container image controlled runtime, server-side automation
winget/scoop Windows developer or desktop distributionDo not start with every channel. Start where your users already install tools and where you can automate correctly.
cargo install is not a release binary pipeline
cargo install deployctl --lockedThis builds from source using the user's toolchain. It is transparent and useful for Rust users, but compilation failures, CPU features, build time, and linker requirements become their problem. Always recommend --locked so dependency resolution follows the committed lockfile.
Release artifacts need identity and integrity
A minimal direct-download release should include:
deployctl-v1.4.0-x86_64-unknown-linux-musl.tar.gz
deployctl-v1.4.0-x86_64-unknown-linux-musl.tar.gz.sha256
deployctl-v1.4.0-x86_64-unknown-linux-musl.tar.gz.minisig
SHA256SUMSChecksums detect corruption and accidental mismatch. Signatures address tampering only if users know which public key is authoritative and how keys rotate. Publishing a hash beside the binary on the same compromised host is not meaningful supply-chain security by itself.
cargo-dist encodes the boring parts correctly
cargo-dist can generate archives, installers, checksums, CI release workflows, and channel-specific metadata:
cargo dist init
cargo dist plan
cargo dist buildUse it when its model matches your project. The value is not magic packaging; it is consistent naming, repeatable CI, and fewer hand-maintained shell scripts. Review generated workflows before trusting them with signing keys.
System packages are lifecycle products
A .deb or .rpm carries installation scripts, service units, file ownership, dependency declarations, upgrades, downgrades, and removal behavior. If your CLI writes state, decide whether package removal deletes that state. Usually it must not. Use a maintainer-owned repository or official distribution channel rather than attaching random package files to a release page forever.
Rollback is a distribution feature
Users need a previous version they can actually install. Keep old artifacts available according to a stated retention policy. Make version discovery deterministic:
deployctl --version
deployctl version --output jsonInclude commit hash, build date, target triple, and feature flags in machine-readable version output. "latest" is not debugging information.
Field notes
- Do not publish artifacts built on a personal laptop as your long-term release process.
- CI signing secrets need narrow permissions, rotation, and protected branches or environments.
- Package managers may run scripts as root; never download and execute unpinned remote content during installation.
- Binaries inside archives should have stable names; version-specific names belong in archive names, not the executable users put in PATH.
- An install script that pipes remote content into a shell must pin versions, verify checksums or signatures, and document its trust model.
Was this lesson helpful?