Packaging and Distribution
Build one set of release archives for each release. Then let each other
channel use these archives or the tagged source. Examples of channels are
.deb and .rpm packages, Homebrew, winget, Scoop, container images,
installers, and distribution ports. This guide adds packaging jobs to the
release workflow in Release automation. That guide already
covers release-plz, Trusted Publishing, the build matrix, cargo-auditable,
SBOMs, checksums, and attestations. Do not make a second release process.
Release archives are the hub
Most channels download a release archive or build from the tag.
cargo-binstall, shell and PowerShell installers, Homebrew taps, winget
portable manifests, Scoop buckets, and AUR -bin packages all download
archives. Thus, the archive names are the most important packaging decision.
Archive names
Use the full Rust target triple in each archive name.
| Platform | Name pattern | Example |
|---|---|---|
| Linux, macOS, BSD | {bin}-{target}.tar.gz or {bin}-{version}-{target}.tar.gz |
my-tool-x86_64-unknown-linux-musl.tar.gz |
| Windows | {bin}-{target}.zip or {bin}-{version}-{target}.zip |
my-tool-aarch64-pc-windows-msvc.zip |
cargo-binstalltries{name}-{target}-v{version},{name}-{version}-{target}, the underscore variants, and{name}-{target}. It looks under tag paths such asv{version}/. Here{name}is the crate name, not the binary name. If the archive names use the crate name and the full triple,Cargo.tomlneeds no[package.metadata.binstall]table. If the binary name is different from the crate name, for example crateripgrepand binaryrg, use the crate name in the archive names or setpkg-urlin[package.metadata.binstall].- Put the binary at the top level of the archive or in a directory with the
archive name. For other layouts, such as a
bin/directory, setbin-dirin[package.metadata.binstall]. - Use
.tar.gz, not.tar.xz, for the widest compatibility. - Do not use short names such as
x86_64-linux.cargo-binstallcannot find these names without overrides. - Put the archives,
SHA256SUMS, and the SBOMs on the draft release. Attest each file. Refer to Release files and verification.
Linux targets
Use a static x86_64-unknown-linux-musl and aarch64-unknown-linux-musl
binary as the portable default. Rust 1.93 updated these targets to
musl 1.2.5.
The musl allocator is slow for small allocations and multi-threaded work. In
the musl-vs-glibc benchmark, a
small malloc and free took 122.61 ns on musl and 10.78 ns on glibc.
- In a musl build, set
mimallocorjemallocas the#[global_allocator]. - For
jemalloconaarch64, setJEMALLOC_SYS_WITH_LG_PAGE=16. - Measure your own work load before you select musl or glibc. An allocator does not replace the optimized glibc string routines.
If you also publish glibc builds, set the glibc version floor explicitly.
cargo-zigbuild accepts a
version suffix, such as --target x86_64-unknown-linux-gnu.2.28. This is more
accurate than a build on an earlier runner image, as in
Target platforms and libraries.
A static binary does not get distribution fixes for C libraries. Use rustls,
not OpenSSL, and scan the release lock file. Refer to
cargo-audit.
GUI applications that link GTK, WebKitGTK, or Vulkan loaders cannot be fully static. Ship them as Flatpak, or as an AppImage that you build on the earliest supported distribution.
Windows and macOS targets
- Build
x86_64-pc-windows-msvcandaarch64-pc-windows-msvcwith-C target-feature=+crt-static. Then the binary does not need the Visual C++ runtime DLL. winget validation fails a package that needs this DLL. aarch64-pc-windows-msvcis a Tier 1 target since Rust 1.91.- Do not use the
*-pc-windows-gnutargets for release binaries. Rust movedi686-pc-windows-gnuto Tier 2 and can demote more GNU targets. aarch64-apple-darwinis Tier 1.x86_64-apple-darwinis Tier 2 with host tools. Refer to rustc platform support.
Install paths on top of the archives
| Path | Source | Limits |
|---|---|---|
cargo install --locked |
crates.io source | Needs a full toolchain. Cannot install man pages, completions, or configuration files. |
cargo binstall |
Release archives | Falls back to a third-party host and then to a source build. Signature checks are opt-in (--only-signed). |
curl | sh, irm | iex |
Release archives | The security is HTTPS and trust in the host. A checksum from the same host gives almost no protection. |
Next to each one-line installer command, give a manual procedure. Tell users to
download the archive, run gh attestation verify, and then extract the binary.
Channel selection by application type
Use this table to select the first channels for a project.
| Packaging decision | CLI tool | GUI application | Service or daemon |
|---|---|---|---|
| Ship first | Triple-named archives, crates.io, SHA256SUMS, attestations |
Signed and notarized .dmg, signed per-user Inno Setup or NSIS EXE (or MSI), Flathub, AppImage |
Multi-architecture distroless :nonroot OCI image with provenance and SBOM. .deb and .rpm with a hardened systemd unit. |
| Add next | .deb from cargo-deb, Homebrew tap (later homebrew-core), winget, Scoop Main, shell and PowerShell installers |
Homebrew cask, winget, Scoop Extras, .deb and .rpm from the bundler, MSIX in the Microsoft Store |
Signed apt or dnf repository, SELinux subpackage, AppArmor profile, Podman Quadlet unit, archives |
| Skip or leave to others | MSI (unless enterprise users ask), Snap, Flatpak, AppImage, Chocolatey | Snap, Chocolatey | Homebrew, winget, Flatpak, Snap, AppImage |
| Confinement it carries | None. Only an in-process sandbox goes with an archive. | Flatpak permissions and portals. macOS hardened runtime. | systemd hardening. Non-root user, read-only root file system, and default seccomp. MAC policy. |
The format controls which security policy goes with the software. Archives,
AppImages, and curl | sh carry no OS policy. For these formats, apply the
sandbox in the binary. Refer to Sandboxing.
For the CLI and GUI stacks, refer to CLI and TUI applications, Desktop GUI applications, and Web APIs.
Format and operating system matrix
“Project” means that your release workflow builds the file. Other entries are built by a third party from your source or archives. A dash means that the format does not apply.
| Format | Linux | macOS | Windows | BSDs | Who builds it |
|---|---|---|---|---|---|
.tar.gz archive |
musl, gnu | aarch64, x86_64 | – | FreeBSD x86_64 (optional) | Project |
.zip archive |
– | Notarization container only | MSVC +crt-static |
– | Project |
cargo install, cargo binstall |
Yes | Yes | Yes | cargo install only |
crates.io and archives |
curl | sh, PowerShell installer |
Yes | Yes | PowerShell | – | Project |
.deb |
Yes | – | – | – | Project or Debian and Ubuntu |
.rpm |
Yes | – | – | – | Project or Fedora |
| Arch and AUR | Yes | – | – | – | Arch maintainers, any person (AUR) |
Alpine apk |
Yes | – | – | – | Alpine maintainers |
| Nix | Yes | Yes | – | – | nixpkgs or project flake |
| Homebrew formula | Yes | Yes | – | – | homebrew-core or project tap |
| Homebrew cask | – | Signed and notarized | – | – | homebrew-cask |
| MacPorts | – | Yes | – | – | MacPorts maintainers |
.app, .dmg |
– | Yes | – | – | Project |
.pkg |
– | Yes | – | – | Project |
| BSD ports | – | – | – | Yes | Ports maintainers |
| OCI image | amd64, arm64 | – | – | – | Project |
| Flatpak | Yes | – | – | – | Project, built by Flathub |
| Snap | Ubuntu mainly | – | – | – | Project, built by Snapcraft |
| AppImage | Yes | – | – | – | Project |
| MSI | – | – | Yes | – | Project |
| EXE installer | – | – | Inno Setup, NSIS | – | Project |
| MSIX and Microsoft Store | – | – | Yes | – | Project, signed by Microsoft |
| winget | – | – | Yes | – | Project pull request |
| Scoop | – | – | Yes | – | Bucket maintainers |
| Chocolatey | – | – | Yes | – | Usually community |
Linux native packages
Build .deb and .rpm files in your release workflow. Also make your source
easy for distributions to package.
Package build tools
| Tool | Formats | Notes |
|---|---|---|
cargo-deb |
.deb |
Needs no debian/ directory. Supports systemd-units, musl variants, and --target. |
cargo-generate-rpm |
.rpm |
Needs no rpmbuild. Supports file caps and --signing_key. Does not strip binaries. |
nfpm |
.deb, .rpm, .apk, Arch |
One YAML file for all formats. Signs packages. |
Do not use cargo-aur or cargo-rpm. These tools are not maintained.
This cargo-deb example installs the binary, a man page, completions, and a
systemd unit. cargo-deb adds the systemd scripts only when you also set
maintainer-scripts. Put the unit file in that directory with the name
<unit-name>.service, for example debian/my-service.service. If the unit is
in a different directory, set unit-scripts to that directory. Refer to the
cargo-deb systemd documentation.
[package.metadata.deb]maintainer-scripts = "debian/"assets = [ ["target/release/my-service", "usr/bin/", "755"], ["target/assets/my-service.1", "usr/share/man/man1/", "644"], ["target/assets/my-service.bash", "usr/share/bash-completion/completions/my-service", "644"], ["README.md", "usr/share/doc/my-service/", "644"],]
[package.metadata.deb.systemd-units]unit-name = "my-service"enable = truestart = falseIn the release workflow, use cargo deb --no-build --target "$TARGET". The
package then contains the binary that the build matrix made.
Signed apt and dnf repositories
A standalone .deb gets no automatic updates. If users need updates, publish a
signed repository. Follow the Debian
third-party repository rules.
- Sign the repository
InReleasefile with a dedicated signing subkey that expires. - Ship the public key in binary
.pgpformat in/usr/share/keyrings/. Use a<project>-archive-keyringpackage. - Do not use
apt-keyor/etc/apt/trusted.gpg.d/. - Give users a deb822
.sourcesfile. SetSigned-Byto the key file, not to a fingerprint. - Pin the repository origin at priority 100 or lower.
- Upload
pool/before the index files. Then no index names a file that is not available.
Types: debURIs: https://example.github.io/aptSuites: stableComponents: mainSigned-By: /usr/share/keyrings/my-tool-archive-keyring.pgpPackage: *Pin: origin example.github.ioPin-Priority: 100reprepro is
sufficient for one project. GitHub Pages does not keep the repository between
runs. Thus, each publication must first download the current repository.
kubecolor
is a good reference. It runs reprepro, pushes to a Pages branch, and ships a
deb822 .sources file in the package.
For dnf, sign each RPM, run createrepo_c, and sign repomd.xml. Then publish
a .repo file with gpgcheck=1.
k6
shows these steps.
Caution. Package scripts operate as root. A repository signature identifies the publisher. It does not protect users from a malicious package. Keep the signing key in the protected
releaseenvironment.
Distribution policies
Each distribution has its own policy for Rust dependencies.
| Distribution | Policy |
|---|---|
| Debian | One source package for each crate (librust-*-dev). No vendored crates. No network during the build. Uses debcargo. |
| Fedora | Packages “SHOULD NOT use bundled crate dependencies”. Vendored packages declare Provides: bundled(crate(...)). Use the rust2rpm output. BuildSystem: cargo is optional. |
| Ubuntu | Main archive vendors crates and records them in XS-Vendored-Sources-Rust. |
| Arch | The developer manual runs cargo fetch --locked, then cargo build --frozen. AUR packages from prebuilt binaries use the -bin suffix. |
| Alpine | The APKBUILD Rust template builds with cargo auditable build --frozen. |
| openSUSE | Vendors all crates with obs-service-cargo and scans them against RustSec. |
| Nix | buildRustPackage with cargoHash or cargoLock.lockFile. For a flake, pin crane to a tag. |
Distribution builds use their own compiler flags, not your
[profile.release] settings. Debian stable and Ubuntu LTS can be some major
versions behind. For a tool that changes quickly, tell these users to use the
upstream archives or Homebrew.
Do these steps to make the source easy to package:
- Publish each crate to crates.io.
- Commit
Cargo.lock. - Do not use git dependencies.
- Keep the
licensefield correct in each crate. - Generate
manpages and completions at build time. - Make the tests pass offline with
--frozen. - Put a self-updater behind a feature that is not a default feature.
Package contents
Native packages are the only Linux formats that can carry OS confinement. Put these items in each package.
| Item | Location | Notes |
|---|---|---|
| Binary | /usr/bin/ |
Use the release binary. |
man page |
/usr/share/man/man1/ |
Generate with clap_mangen. |
| Completions | /usr/share/bash-completion/completions/ and the Zsh and Fish directories |
Generate with clap_complete. |
| systemd unit | /usr/lib/systemd/system/ |
Services only. Harden the unit. |
| Configuration | /etc/my-service/ |
cargo-deb marks files in /etc as conffiles. Use config = "noreplace" in cargo-generate-rpm. |
| MAC policy | <pkg>-selinux subpackage, /etc/apparmor.d/ |
Refer to the list after this table. |
Harden each systemd unit. This example is a start point. The [Install]
section is necessary. Without it, enable = true cannot enable the unit at boot.
[Unit]Description=My service
[Service]ExecStart=/usr/bin/my-serviceDynamicUser=yesNoNewPrivileges=yesProtectSystem=strictProtectHome=yesPrivateTmp=yesPrivateDevices=yesCapabilityBoundingSet=SystemCallFilter=@system-serviceStateDirectory=my-service
[Install]WantedBy=multi-user.targetCheck the unit in CI. The job fails if the exposure score is more than the
threshold. The threshold uses a scale from 0 to 100, so --threshold=30 is a
limit of 3.0 in the command output.
systemd-analyze security --offline=yes --threshold=30 debian/my-service.serviceFor a command that a user starts and that needs one privilege, set a file
capability with the caps field in cargo-generate-rpm. Do not use setuid.
A file capability has no effect in a unit with NoNewPrivileges=yes or an
empty CapabilityBoundingSet=. For a service, set the capability in the unit
with AmbientCapabilities= and add the same capability to
CapabilityBoundingSet=. Refer to
systemd.exec(5).
For mandatory access control (MAC) policy, use these patterns:
- Fedora and RHEL. Ship a noarch
<pkg>-selinuxsubpackage. Install the module with%selinux_modules_installat priority 200. Refer to SELinux/IndependentPolicy. The Fedora Packaging Committee did not approve this draft, but packages use it. - openSUSE. Tumbleweed, Leap 16.0, and SLES 16.0 use SELinux by default. Ship an SELinux module, not an AppArmor profile.
- Debian and Ubuntu. Install the profile with
dh_apparmor.cargo-debhas no AppArmor support. Add the profile as an asset under/etc/apparmor.d/. Copy the Debianpostinstandpostrmfragments into your scripts above#DEBHELPER#. In both fragments, replace#PROFILE#with the profile file name.cargo-debreplaces only#DEBHELPER#.
On Ubuntu, a binary that makes user namespaces needs an AppArmor profile with
the userns, rule. Only a package that root installs can supply this profile.
A tarball or an AppImage cannot. For policy contents, refer to
Sandboxing.
Flatpak, Snap, and AppImage
These formats are for GUI applications. Do not use them for a plain CLI tool.
Flatpak and Flathub
Flathub is the main Linux GUI channel. Flathub requires a build from source with no network access.
- Generate
cargo-sources.jsonfromCargo.lockwithflatpak-cargo-generator.py. Commit the file with the manifest. - Build with the
rust-stableSDK extension. Its branch must match the runtime version. - Select a current runtime. Use
org.freedesktop.Platform//26.08foriced,egui, andwgpuapplications. Use a current GNOME runtime for GTK,libadwaita, and Tauri applications. - Use an
io.github.<user>.<repo>application ID for a project on GitHub. - Keep static permissions to a minimum. Use portals where a portal is available. Refer to Sandboxing.
Caution. The 26.08
rust-stableextension supplies Rust 1.98.0, which is older than the current stable release. Updates on the 26.08 branch need a manual merge by a Flathub maintainer. Make sure that your MSRV is not more than the extension version. Refer to Minimum supported Rust version.
Caution. Flathub states that “Flathub manifests must not contain AI-generated or AI-assisted content”. A person must write the Flathub manifest.
Snap
The Snapcraft rust plugin
builds Rust snaps. Use base: core24 or core26. A developer tool that
touches arbitrary paths needs
classic confinement,
which removes the sandbox and needs manual store approval. Use Snap only as a
secondary channel.
AppImage
- Use
appimagetoolwith the static type2 runtime. This runtime does not needlibfuse2. - Pin a tagged release, or record the SHA-256 of the
continuousdownload. - Build on the earliest distribution that you support, such as Ubuntu 22.04.
- Sign the AppImage with
appimagetool -s. Add zsync update information.
AppImage has no reviewed store and no OS confinement.
macOS
Homebrew 7 rules
Homebrew is the main macOS channel for CLI tools. Apply these rules.
- homebrew-core needs a known project. A third-party submission needs 75 stars (or 30 forks or watchers). A self-submission needs 225 stars (or 90 forks or watchers). Refer to the acceptance policy.
- homebrew-core builds from source. BrewTestBot updates core formulae every 3 hours. You do no release work for a formula in core.
- Use a tap until core accepts the project.
distand GoReleaser generate tap formulae. In GoReleaser, usehomebrew_casks. Thebrewspipe is deprecated. - Users must trust a tap. Homebrew 6.0.0 added
tap trust. In
README.md, givebrew install owner/tap/my-tool. This command trusts only that item. - Every cask must pass Gatekeeper. Homebrew disabled 627 casks for
fails_gatekeeper_checkin September and October 2026. The audit also examinessuitefolders,artifactitems, and installer scripts. Sign and notarize each Mach-O file in a cask. - Users cannot skip quarantine. Homebrew 6.0.0 removed
--no-quarantine. Homebrew quarantines all cask downloads. - Intel Macs are Tier 3. Homebrew 7.0.0 moved Intel macOS to Tier 3.
Support stops on 2027-09-01. Bottles need macOS 15 or later. If you
support Intel Macs, publish your own
x86_64or universal binaries. Refer to the Homebrew 7.0.0 notes.
A native .app is not a formula. Submit a GUI application to
homebrew-cask and point the cask
to the notarized .dmg.
MacPorts
MacPorts builds Rust ports with PortGroup cargo 1.0 and a crate list from
cargo2port. The +universal variant is easy to add. Let community
maintainers keep the port. Refer to the
MacPorts Guide.
Signing and notarization
Outside the Mac App Store, Gatekeeper needs a signed and
notarized
program. An Apple Developer Program
membership costs US$99 each year. Sign with a Developer ID certificate, the
hardened runtime, and a secure timestamp. Submit with notarytool, not
altool.
Use the correct identity for each container. Refer to Packaging Mac software for distribution.
| Container | Signing identity | Staple a ticket |
|---|---|---|
.app and Mach-O binaries |
Developer ID Application | .app: yes. Standalone binary: no. |
.dmg (read-only UDZO) |
Developer ID Application | Yes |
.pkg |
Developer ID Installer | Yes |
.zip |
Not signed | No |
Sign nested code first. Notarize only the outermost container. Without a stapled ticket, a Mac with no network can block the program.
A bare CLI binary gets a stapled ticket only in a .pkg or a .dmg. This
example makes a signed and notarized .pkg on a macOS runner.
codesign --force --options runtime --timestamp \ --sign "Developer ID Application: Example Ltd (TEAMID)" stage/my-toolpkgbuild --root stage --install-location /usr/local/bin \ --identifier com.example.my-tool --version "$VERSION" \ --sign "Developer ID Installer: Example Ltd (TEAMID)" --timestamp \ my-tool.pkgxcrun notarytool submit my-tool.pkg \ --key AuthKey.p8 --key-id "$ASC_KEY_ID" --issuer "$ASC_ISSUER_ID" --waitxcrun stapler staple my-tool.pkgTo sign and notarize from a Linux runner, use
rcodesign
from apple-codesign. Use an App Store Connect API key.
rcodesign sign --p12-file developer-id.p12 --p12-password-file p12-password.txt \ --for-notarization MyApp.apprcodesign notary-submit --api-key-file asc-key.json --staple MyApp.appThis example notarizes and staples the signed .app. To ship a .dmg, make
the .dmg from the stapled .app, sign it, and then submit the .dmg.
The last rcodesign release is from November 2024. Pin it, and keep a macOS
runner with codesign and notarytool as a fallback.
Caution. Notarization can take a long time. Set
timeout-minuteson the job.
Keep the certificates and API keys in the protected release environment.
Refer to Secure development lifecycle.
When a CLI needs notarization
Gatekeeper examines only files with the com.apple.quarantine attribute.
Safari and Homebrew casks set this attribute.
curl and Homebrew formula
bottles do not. Thus, users of curl | sh, formulae, and cargo install do not
start Gatekeeper. Notarize each .pkg, .dmg, and cask download.
Universal binaries
Cargo cannot build a universal binary. Build aarch64-apple-darwin and
x86_64-apple-darwin. Then combine the two binaries with lipo.
lipo -create -output stage/my-tool \ target/aarch64-apple-darwin/release/my-tool \ target/x86_64-apple-darwin/release/my-toolRun lipo before you sign, because lipo makes signatures invalid. Tauri
uses --target universal-apple-darwin. dist cannot build universal binaries.
Hardened runtime entitlements
The hardened runtime decreases the risk of exploits. It is not a resource sandbox. A typical Rust CLI or server needs no runtime exceptions.
| Entitlement | Use it when | Notes |
|---|---|---|
com.apple.security.cs.allow-jit |
The program embeds a JIT compiler. | Permits MAP_JIT memory. |
com.apple.security.cs.disable-library-validation |
The program loads plug-ins signed by a different team. | Gatekeeper does more checks. |
com.apple.security.cs.allow-unsigned-executable-memory |
Do not use. | Apple states that it “exposes your app to common vulnerabilities”. |
Put entitlements only on executables. Do not write an entitlement with the
value false. Leave it out. The Mac App Store needs App Sandbox entitlements.
Refer to Sandboxing.
Services with launchd
- A launchd job
is a plist with
LabelandProgramArgumentsin/Library/LaunchDaemons. The program must not daemonize itself. - For an application on macOS 13 or later, put the plist in the bundle and
register it with
SMAppService. An administrator must approve a daemon in System Settings. - For a CLI daemon from Homebrew, add a
service doblock to the formula. Users then start it withbrew services. Refer to Service files.
Windows
Format selection
| Format | Use it for | Notes |
|---|---|---|
.zip |
CLI tools | One static MSVC .exe for each target. winget and Scoop install it as a portable package. |
| Inno Setup EXE | GUI applications | Per-user install with PrivilegesRequired=lowest and no UAC prompt. Refer to Zed. |
| NSIS EXE | GUI applications | Tauri uses NSIS. No fee. |
| MSI | Enterprise deployment with Group Policy or Intune | Keep the UpgradeCode stable. |
| MSIX | Microsoft Store | Microsoft signs the package. No SmartScreen warning. |
The Microsoft Store
is free for individual developers. Microsoft re-signs each MSIX package after
certification. Make the package with the
winapp CLI
(public preview). Do the first Store submission manually in Partner Center.
MSI with WiX
WiX v7 uses the
Open Source Maintenance Fee EULA.
The fee of US$10 to US$60 each
month applies to revenue work with annual gross revenue of US$10,000 or more.
Each WiX v7 command fails until you accept wix7.
| Tool | WiX version | ARM64 |
|---|---|---|
cargo-wix 0.3.9 (released) |
v3.14.1 only | No. Fails with CNDL0264. |
cargo-wix from git main with --toolset modern |
v4 to v7 | Yes |
dist, Tauri bundler |
v3.14.1 | No |
WiX v3 has no upstream support. For a new MSI, use cargo-wix from git with
--toolset modern. bottom
(WiX 4) and PWAsForFirefox
(WiX 7.0.1) build ARM64 MSIs this way.
dotnet tool install --global wix --version 7.0.1wix eula accept wix7cargo install --locked --git https://github.com/volks73/cargo-wix --rev FULL_COMMIT_SHA cargo-wixcargo wix --toolset modern --no-build --target x86_64-pc-windows-msvcPin cargo-wix to a full commit hash and pin the wix tool version. To use
WiX without the fee terms, pin WiX v5 or earlier.
winget, Scoop, and Chocolatey
| Manager | How it gets updates | Your work |
|---|---|---|
| winget | Manifest pull request to microsoft/winget-pkgs |
Do the first submission. Then automate updates with Komac. |
| Scoop | Bucket checkver and autoupdate |
Submit once to Main (CLI) or Extras (GUI). |
| Chocolatey | A person reviews each new version | Usually let a community maintainer do it. |
winget validation checks the hash, the installer domain, a silent install and
uninstall, Visual C++ runtime dependencies, and antivirus scans. Use GitHub
release URLs. Do not use URL redirectors. winget does not require a code
signature. Komac needs a classic personal access token with the
public_repo scope. A fine-grained token cannot open the pull request.
winget and Scoop installs usually avoid the Mark-of-the-Web prompt. Smart App Control still blocks unsigned executables that have no reputation.
Code signing
Microsoft states that the EV certificate SmartScreen bypass “was removed in 2024”. Do not buy an EV certificate only for SmartScreen.
| Option | Cost | Publisher name | Notes |
|---|---|---|---|
| Azure Artifact Signing | US$9.99 each month (Basic, 5,000 signatures) | Your validated legal name | Needs a paid Azure subscription. Organizations in the USA, Canada, EU, UK, and some other countries. Individuals in the USA or Canada only. Keys stay in an HSM. |
| SignPath Foundation | Free for eligible open-source projects | “SignPath Foundation” | OSI license, no proprietary parts, MFA for all members, and manual approval of each release. Shared OV certificate. All jobs before the signing request must use GitHub-hosted runners. |
| OV certificate | About US$150 to US$300 each year | Your name | Key must be in an HSM. Maximum validity is 460 days. |
| MSIX in the Store | Free | Your Store name | Microsoft signs the package. |
- A SignPath project shares SmartScreen reputation with all other SignPath projects. Add a manual approval gate before the SignPath signing job.
- SmartScreen reputation increases over “several weeks and hundreds of clean installs”.
osslsigncodesigns Authenticode files from a Linux runner.- Sign the
.exebefore you put it in the.zip. Sign each installer and uninstaller.
Signing identifies the publisher. It does not confine the program. For Windows process mitigation policies, refer to Sandboxing.
Windows services
- Implement the Service Control Manager entry point with
windows-service. Microsoft also publishes the smallerwindows-servicescrate. - Register the service in the MSI with the WiX
ServiceInstallandServiceControlelements. Windows Installer then does repair and uninstall. - Write a custom
main.wxs. The defaultcargo-wixtemplate has no service elements. Firezone is an example.
If a binary has no SCM support, use WinSW or shawl. Do not use NSSM.
BSD ports
FreeBSD, OpenBSD, and NetBSD users usually install from ports. Each port system downloads each crate as a distfile with a checksum and builds offline.
| System | Framework | Crate list command |
|---|---|---|
| FreeBSD | USES=cargo |
make cargo-crates |
| OpenBSD | MODULES=devel/cargo |
make modcargo-gen-crates |
| NetBSD pkgsrc | lang/rust/cargo.mk |
make print-cargo-depends |
FreeBSD and NetBSD x86_64 are Tier 2 targets. OpenBSD is Tier 3, so an
OpenBSD binary needs a native build. Git dependencies are difficult in all
three systems.
- Follow the source rules in Distribution policies.
- Do a build and test on FreeBSD each week or before each release. Use
vmactions/freebsd-vmin GitHub Actions. - Optionally, attach a FreeBSD
x86_64archive to the release. - Let ports maintainers make and update the ports.
Cirrus CI stopped operation on 1 June 2026. Add the FreeBSD job to the scheduled checks in CI/CD pipeline.
Container images
Ship a service as a multi-architecture OCI image. Use a minimal base image and a non-root user. For application settings, refer to Container packaging and deployment.
| Binary | Base image | Compressed size (amd64) |
|---|---|---|
| glibc | gcr.io/distroless/cc-debian13:nonroot |
About 10.7 MB |
| Static musl | gcr.io/distroless/static-debian13:nonroot |
About 0.9 MB |
| Static musl | scratch |
0 MB. Has no CA certificates or /etc/passwd. Copy a CA bundle into the image if the binary makes outbound TLS connections. |
debian:trixie-slim is about 30 MB and gives scanners more advisories to
triage.
# syntax=docker/dockerfile:1FROM rust:1-slim-trixie@sha256:BUILDER_DIGEST AS buildWORKDIR /srcRUN cargo install --locked cargo-auditableCOPY . .RUN --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/src/target \ cargo auditable build --release --locked \ && cp target/release/my-service /my-service
FROM gcr.io/distroless/cc-debian13:nonroot@sha256:RUNTIME_DIGESTCOPY --from=build /my-service /usr/local/bin/my-serviceUSER 65532:65532ENTRYPOINT ["/usr/local/bin/my-service"]- Pin each base image by digest.
- Build with
cargo auditable. Without it, an SBOM scan of a minimal image finds no Rust crates. - Cache dependencies with BuildKit cache mounts or
cargo-cheflayers. - Do not compile under QEMU emulation. Build each platform on a native runner
(
ubuntu-24.04andubuntu-24.04-arm) and merge the manifests. Or build on$BUILDPLATFORMand cross-compile withcargo-zigbuild. Refer to Multi-platform builds. - Push to GitHub Container Registry.
- In
docker/build-push-action, setprovenance: mode=max,sbom: true, andpush: true. Refer to Docker attestations. - Attest the image digest with
actions/attestandsubject-digest. Users verify it withgh attestation verify oci://…. - Optionally, sign the image with keyless Cosign v3.
At run time, the image must meet the Kubernetes
restricted Pod Security Standard.
Set runAsNonRoot, the RuntimeDefault seccomp profile, no privilege
escalation, drop: ["ALL"] capabilities, and readOnlyRootFilesystem. An
image must never need --privileged or seccomp=unconfined.
For a single host, supply a Podman Quadlet
.container unit.
Set ReadOnly=true, NoNewPrivileges=true, DropCapability=all,
UserNS=auto, and a non-root User=. Do not set SeccompProfile=. Then the
default profile applies. Refer to Sandboxing.
For Kubernetes charts, use Helm 4. Helm 3 security fixes stopped on 2026-11-11.
Tool selection
No one tool makes all formats. Many large projects use their own workflows.
| Tool | Makes | Use it for | Cautions |
|---|---|---|---|
dist |
Archives, shell and PowerShell installers, Homebrew tap, MSI (WiX v3), checksums, attestations | CLI installers | Community-maintained by one person since Axo closed (maintainer). No .deb, .rpm, .pkg, or notarization. |
| GoReleaser | Archives, nfpm packages, Homebrew, Scoop, winget, AUR, Docker |
Projects that already use GoReleaser | Rust support is alpha. Weak workspace support. Defaults to x86_64-pc-windows-gnu. DMG, MSI, and notarization need Pro. |
| Tauri bundler | .app, .dmg, MSI, NSIS, .deb, .rpm, AppImage |
Tauri applications | Signs and notarizes. MSI uses WiX v3. |
cargo-packager |
Same as Tauri, with a signed updater | egui, iced, and Slint applications |
No crates.io release since November 2025. |
dx bundle (Dioxus) |
Desktop and mobile bundles | Dioxus applications | Uses its own copy of the Tauri bundler since 0.7.4. |
cargo-bundle |
.app, .dmg, .deb, .rpm, MSI |
Simple GUI applications | Early alpha. Signs but does not notarize. |
taiki-e/upload-rust-binary-action |
Archives and checksums | Small CLI projects | No packages. |
cargo-zigbuild |
Cross builds | glibc version floor, musl | Does not target the BSDs. |
cross |
Cross builds in containers | Targets that cargo-zigbuild does not support |
No release since February 2023. Pin a git revision. |
Extend the release workflow
Release automation already makes the tag, the draft release, the binaries, the SBOMs, and the attestations. Add packaging jobs to this workflow. Do not replace it with a different release tool.
| Job | needs |
Adds | Signing and attestation |
|---|---|---|---|
release-pr, release (current) |
– | Version, changelog, crates.io, tag, draft release | Trusted Publishing, release environment |
build-binaries (extend) |
release |
musl targets, +crt-static MSVC, x86_64-apple-darwin |
Windows and macOS signatures before the archive step |
package-linux (new) |
build-binaries |
.deb, .rpm, man pages, completions, systemd unit |
RPM signatures, systemd-analyze security gate |
package-gui (new, GUI only) |
build-binaries |
.dmg, EXE or MSI, AppImage |
Notarization, stapled ticket, Authenticode |
container (services) |
release |
Multi-architecture image on GHCR | BuildKit provenance and SBOM, actions/attest |
| SBOM and checksum step (extend) | All packaging jobs | Add .deb, .rpm, .msi, .exe, .dmg, .AppImage to SHA256SUMS and to subject-path |
One attestation set for each file |
publish-release (current) |
Each job that uploads | Removes the draft flag | gh release verify |
distribute (new) |
publish-release |
winget, Homebrew tap, apt and dnf repositories, AUR -bin |
Repository signing subkey from the release environment |
Obey these rules when you add jobs:
- Upload all files before publication. Add each packaging job to the
needslist ofpublish-release. Refer to Build provenance attestations and immutable releases. - Sign first, then calculate checksums, then attest. A signature changes the file.
- Start distribution jobs with
needs, not withon: release.publish-releaseuses the defaultGITHUB_TOKEN, which does not starton: releaseworkflows. Refer to GitHub App token for the release workflow. - Use the GitHub release URLs in winget and Scoop manifests.
Example distribute job for winget
This job sends the winget update after publication. Keep the classic token in
the release environment. Do not put the token on the command line.
distribute-winget: needs: [release, publish-release] if: ${{ needs.release.outputs.releases_created == 'true' }} runs-on: ubuntu-latest environment: release permissions: {} steps: - uses: dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc # master with: toolchain: stable - name: Install Komac run: cargo install --locked komac --version 2.17.2 - name: Submit winget update env: # Classic PAT with the public_repo scope. Komac reads GITHUB_TOKEN. GITHUB_TOKEN: ${{ secrets.WINGET_TOKEN }} RELEASES: ${{ needs.release.outputs.releases }} BASE: https://github.com/${{ github.repository }}/releases/download run: | # Select the entry for this package. A workspace release can contain # entries for other packages. entry=$(jq -ec '.[] | select(.package_name == "my-tool")' <<< "$RELEASES") || exit 0 version=$(jq -er '.version' <<< "$entry") tag=$(jq -er '.tag' <<< "$entry") komac update Example.MyTool --version "$version" --submit \ --urls "$BASE/$tag/my-tool-x86_64-pc-windows-msvc.zip" \ "$BASE/$tag/my-tool-aarch64-pc-windows-msvc.zip"If the release does not contain my-tool, the step stops without a
submission. The URLs use the {bin}-{target}.zip archive names. If you put the
version in the archive name, change the URLs to agree. Do the first winget
submission manually.
dist installers with release-plz drafts
Add dist only for its shell and PowerShell installers or its Homebrew tap.
With create-release = false, dist uploads its files to the release-plz
draft and then removes the draft flag. Refer to the
create-release setting.
[workspace]members = ["cargo:."]
[dist]cargo-dist-version = "0.34.0"ci = "github"create-release = falsecargo-auditable = trueinstallers = ["shell", "powershell"]github-attestations = truegithub-attestations-phase = "host"github-release = "host"targets = ["aarch64-apple-darwin", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]Quantinuum/hugr
uses this configuration with git_release_draft = true in
release-plz.toml.
- Make the
disttag pattern agree withgit_tag_nameinrelease-plz.toml. For a prefixed tag, settag-namespace. - Push the tag with a GitHub App token or a personal access token. A tag from
the default
GITHUB_TOKENdoes not start thedistworkflow. Thereleasejob in The release workflow already uses an App token. - Use one publication step. The
distworkflow starts from the tag, so it runs separately from therelease-plzworkflow. Aneedslist in one workflow cannot wait for a job in the other. Removepublish-releasefrom therelease-plzworkflow, and letdistremove the draft flag. - Move the SBOMs, checksums, attestations, and packaging jobs into the
distworkflow as custom jobs. Useglobal-artifacts-jobsfor jobs that use the archives thatdistbuilds. These jobs start after the local builds, and thedisthostjob waits for them before it publishes. Do not put uploads inhost-jobs. These jobs run at the same time as thehostjob, which can publish before they finish.diststarts allglobal-artifacts-jobsat the same time. Thus, put the packaging, signing, checksum, and attestation steps in one reusable workflow, in that order. If they are separate jobs, the checksum job can finish before the packages exist. These jobs also run at the same time as thedistjob that builds the shell and PowerShell installers, so they cannot see the installers. Make your checksum file and attestations cover only the files that your job makes.distmakes its own checksums for the archives and installers, andgithub-attestations = truewithgithub-attestations-phase = "host"attests them. The default phase runs beforedistbuilds the installers, so it attests only the archives. Thehostphase needsgithub-release = "host". release-plz pushes the tag before it creates the draft release. If thedisthostjob starts before the draft exists, the upload fails. Run thedistworkflow again after the draft exists.cargo-auditable = truemakesdistembed the dependency list in each binary. A later job cannot add it to a binary that is already built. - Run the
distributejobs, such as winget, aspost-announce-jobs. These jobs are reusable workflows. They get thedistplan as theplaninput, not therelease-plzoutputs. Read the tag and version from the plan, for examplejq -r '.announcement_tag' <<< "$PLAN". Remove theneedslist and theifcondition of the exampledistributejob, because thereleasejob outputs do not exist in thedistworkflow. Apost-announce-jobsjob runs only afterdistpublishes a release. To skip releases that do not containmy-tool, select from the plan, for examplejq -e '.releases[] | select(.app_name == "my-tool")' <<< "$PLAN". - The
distworkflow runs on the tag, not onmain. If thereleaseenvironment allows onlymain, add a deployment rule for the release tag pattern, such asv*. Keep the required reviewers on the environment.
Caution. If a job in one workflow uploads files while a job in the other workflow publishes the release, the uploads can fail because a published release is immutable. If you cannot put all uploads in one workflow, do not use
dist.