Skip to content

Instantly share code, notes, and snippets.

@Blankeos
Created January 9, 2026 12:44
Show Gist options
  • Select an option

  • Save Blankeos/170d83f0367cd9e9b2b1961513f6695c to your computer and use it in GitHub Desktop.

Select an option

Save Blankeos/170d83f0367cd9e9b2b1961513f6695c to your computer and use it in GitHub Desktop.
Publishing on Cargo for dumdums

Publishing a Cargo Project to crates.io

  1. Prepare Your Project

Ensure your Cargo.toml has all required fields:

[package]
name = "crate-name"
version = "0.1.0"
edition = "2021"
description = "Brief description"
authors = ["Your Name <email@example.com>"]
license = "MIT"  # or SPDX identifier
repository = "https://github.com/user/repo"
keywords = ["keyword1", "keyword2"]
categories = ["category1", "category2"]
readme = "README.md"
  1. Create crates.io Account
  2. Go to https://crates.io/
  3. Sign up / log in
  4. Go to Account Settings → API Tokens
  5. Click "New Token"
  6. Give it a name and select "Public API"
  7. Copy the token
  8. Login to crates.io
cargo login
# Paste your API token when prompted
  1. Verify Package Metadata
cargo package --allow-dirty
cargo publish --dry-run

Check for warnings about:

  • Missing documentation
  • Build warnings
  • Dependency issues
  1. Publish
cargo publish
  1. Verify Visit https://crates.io/crates/your-crate-name to verify it's published. Common Issues
  • Name already taken: Choose a different name
  • Missing docs: Add //! module-level docs
  • License not SPDX: Use valid SPDX identifier (e.g., MIT, Apache-2.0)
  • Version conflict: Must increment version (0.1.0 → 0.1.1 or 0.2.0) Versioning (SemVer)
  • 0.1.00.1.1 (bug fixes, compatible)
  • 0.1.00.2.0 (new features, compatible)
  • 0.1.01.0.0 (breaking changes) Yanking a Version If you publish with issues:
cargo yank --vers 0.1.0
cargo unyank --vers 0.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment