Publishing to crates.io uploads Rust source code, not a prebuilt executable.
After publishing, users install the CLI with:
cargo install cli-botThat command compiles cli-bot on the user's machine.
If you want prebuilt binaries, publish release artifacts separately, for example through GitHub Releases.
Fill in the remaining package metadata in Cargo.toml before publishing publicly:
licenseorlicense-filerepository- optionally
homepage - optionally
documentation
The crate already includes some useful metadata:
descriptionreadmekeywordscategories
- Sign in at
https://crates.io/. - Create an API token in your account settings.
- Authenticate locally:
cargo loginRun the standard checks:
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets --all-featuresThen build the publishable archive locally:
cargo packageYou can inspect the generated package contents with:
cargo package --listThe repository includes these workflows:
.github/workflows/release-checks.yml.github/workflows/unit-coverage.yml.github/workflows/coverage-pages.yml
release-checks.yml does two things:
- Runs release checks on pull requests and pushes to
main - Prepares a publishable
.crateartifact on version tags likev0.1.0or manual workflow dispatch
The verification job runs:
cargo fmt --all --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets --all-features
cargo package
cargo package --listOn matching tags or manual runs, the workflow also uploads the packaged crate from target/package/*.crate as a GitHub Actions artifact.
unit-coverage.yml runs bash ./scripts/coverage-unit.sh and uploads:
target/coverage/html/target/coverage/unit-report.txttarget/coverage/unit-tests.profdatatarget/coverage/lcov.info
It also uploads the LCOV report to Codecov.
coverage-pages.yml rebuilds the unit-test HTML coverage report on pushes to main and deploys it to GitHub Pages.
Before the first deployment succeeds, enable Pages in the repository settings:
- Open
Settings -> Pages - Set the source to
GitHub Actions - Allow the workflow deployment to publish the site
Expected coverage site URL:
https://joelee.github.io/cli-bot/
cargo publishAfter the first publish, users can install it with:
cargo install cli-botFor each new release:
- Update
versioninCargo.toml. - Re-run the local verification steps.
- Run
cargo publish.
Users can then upgrade with:
cargo install cli-bot --forceIf you want users to avoid a local Rust build, publish binaries separately.
Common approach:
- Build release artifacts in CI for each target platform.
- Upload them to a GitHub Release.
- Optionally support tools like
cargo-binstall.