Add static musl builds for Linux and conditional crate publishing #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces support for statically compiled binaries using musl libc for Linux targets (x86_64 and aarch64), making the rustfs-cli more portable across Linux distributions without glibc dependencies. It also adds a check for the presence of CARGO_REGISTRY_TOKEN to conditionally enable crate publishing to crates.io, preventing failures in forks or environments without the token.
Key changes:
Build Matrix Updates:
Added new statically-compiled entries for x86_64-unknown-linux-musl and aarch64-unknown-linux-musl targets. Changed the dynamically-linked glibc x86_64 target to run on ubuntu-22.04 for better glibc compatibility across systems.
Workflow Steps:
Added
rustup target addstep for all targets and musl-tools installation for musl-based builds to support compilation of dependencies like ring.Build Check Enhancements:
Detect if CARGO_REGISTRY_TOKEN is set and output has_token for conditional logic.
Publish Job:
Only run if it's a release build and the token is available.
These changes ensure broader compatibility for distributed binaries and safer publishing workflows.
You can validate the successful compilation of the binaries from the workflow run in the fork:
https://github.com/aabmets/rustfs-cli/actions/runs/21518772103
You can test the binaries compiled in the fork from the release published in the fork:
https://github.com/aabmets/rustfs-cli/releases/tag/v0.1.3