# Publishing to crates.io
## Steps to Publish
### 1. Complete Cargo.toml Metadata
Update these fields in `Cargo.toml`:
- `authors` - Your name and email
- `repository` - Your GitHub repo URL
- `homepage` - Your project homepage
### 2. Get crates.io API Token
1. Visit https://crates.io/
2. Login with GitHub
3. Go to Account Settings → API Tokens
4. Generate a new token
5. Copy the token
### 3. Login to cargo
```bash
cargo login <your-api-token>
```
This saves the token to `~/.cargo/credentials`
### 4. Verify Package
Check everything is correct:
```bash
cargo package --list
```
This shows what files will be included in the package.
### 5. Publish!
```bash
cargo publish
```
### 6. Install and Test
After publishing (takes a few minutes to index):
```bash
cargo install hyprtask
```
Then anyone can install it with:
```bash
cargo install hyprtask
```
## Important Notes
⚠️ **Package names are permanent** - You cannot delete or change a package name once published
⚠️ **Versions are immutable** - You cannot modify a published version (but can yank it)
⚠️ **Include necessary files** - Make sure `README.md` and `LICENSE` are included
## Version Updates
To publish a new version:
1. Update version in `Cargo.toml`
2. Commit changes
3. Run `cargo publish` again
## Before Publishing Checklist
- [ ] Fill in all Cargo.toml metadata
- [ ] Add LICENSE file
- [ ] Update README.md
- [ ] Test build: `cargo build --release`
- [ ] Test package: `cargo package`
- [ ] Commit all changes to git
- [ ] Create git tag: `git tag v0.1.0`
- [ ] Push to GitHub: `git push && git push --tags`
- [ ] Run `cargo publish`
## After Publishing
Users can install with:
```bash
cargo install hyprtask
```
And the binary will be at `~/.cargo/bin/hyprtask`
## Useful Commands
```bash
# Check package content
cargo package --list
# Build without publishing (dry run)
cargo publish --dry-run
# Yank a version (doesn't delete, just prevents new installs)
cargo yank --vers 0.1.0
# Un-yank a version
cargo yank --vers 0.1.0 --undo
```
## Resources
- [Cargo Book - Publishing](https://doc.rust-lang.org/cargo/reference/publishing.html)
- [crates.io Policies](https://crates.io/policies)
- [crates.io](https://crates.io/)