This guide will help you publish your api-guidelines crate to crates.io.
- Crates.io Account: You need an account on crates.io
- API Token: Get your API token from your crates.io account settings
- Cargo Login: Run
cargo loginwith your API token
Make sure your crate is ready for publishing:
# Build the crate to check for errors
cargo build
# Run tests
cargo test
# Check documentation
cargo doc --open
# Run clippy for code quality
cargo clippy
# Check formatting
cargo fmt -- --checkYour Cargo.toml should include:
name- "api-guidelines" ✓version- "0.1.0" ✓description- Added ✓license- "MIT" ✓repository- GitHub URL ✓documentation- docs.rs URL ✓readme- "README.md" ✓keywords- Added ✓categories- Added ✓
# Login with your API token
cargo loginYou'll be prompted to enter your API token from crates.io.
# Check if your package can be published without actually publishing
cargo publish --dry-runThis will validate your package without uploading it.
# Publish to crates.io
cargo publishAfter publishing:
- Visit https://crates.io/crates/api-guidelines
- Check that your documentation appears at https://docs.rs/api-guidelines
After publishing, you cannot modify or delete published versions. To make changes:
- Bug Fixes: Bump patch version (0.1.0 → 0.1.1)
- New Features: Bump minor version (0.1.0 → 0.2.0)
- Breaking Changes: Bump major version (0.1.0 → 1.0.0)
It's good practice to tag releases:
git tag v0.1.0
git push origin v0.1.0If "api-guidelines" is taken, you'll need to choose a different name in Cargo.toml.
Ensure all required fields in Cargo.toml are filled.
Make sure your code compiles and all doc tests pass.
Ensure LICENSE file exists and matches the license specified in Cargo.toml.
- Semantic Versioning: Follow semver.org for versioning
- Changelog: Consider adding a CHANGELOG.md file
- CI/CD: Set up GitHub Actions for automated testing and publishing
- Documentation: Keep documentation up to date
- Dependencies: Keep dependencies minimal and up to date
After successful publication:
- Share your crate with the Rust community
- Monitor downloads and issues
- Consider adding more API guideline categories
- Add utility functions for working with the guidelines
- Create examples and tutorials
# Check crate info
cargo package --list
# Update dependencies
cargo update
# Check for outdated dependencies
cargo outdated
# Generate lockfile (if needed)
cargo generate-lockfileIf you encounter issues:
- Check Cargo documentation
- Visit crates.io help