# Setup and Publishing Guide
This guide will help you set up your GitHub repository and publish to crates.io.
## Initial Setup
### 1. Create GitHub Repository
```bash
cd error-location
git init
git add .
git commit -m "Initial commit: error-location crate v0.1.0"
```
Create a new repository on GitHub, then:
```bash
git remote add origin https://github.com/yourusername/error-location.git
git branch -M main
git push -u origin main
```
### 2. Update Repository URLs
Before publishing, update these files with your actual GitHub username:
**Cargo.toml:**
- Line with `repository = "https://github.com/yourusername/error-location"`
- Line with `authors = ["Tony <your-email@example.com>"]`
**README.md:**
- All badge URLs
- License link at the bottom
**CHANGELOG.md:**
- All version comparison URLs
### 3. Verify the Build
```bash
# Test that everything compiles
cargo build --release
# Run all tests
cargo test --all-features
# Check formatting
cargo fmt --all -- --check
# Run clippy
cargo clippy --all-targets --all-features -- -D warnings
# Build documentation
cargo doc --no-deps --open
```
## Publishing to crates.io
### 1. Create crates.io Account
1. Visit https://crates.io/
2. Sign in with GitHub
3. Go to Account Settings → API Tokens
4. Create a new API token
### 2. Login to cargo
```bash
cargo login <your-api-token>
```
### 3. Publish
```bash
# Dry run to check for issues
cargo publish --dry-run
# Actually publish
cargo publish
```
## Pre-Release Checklist
Before each release:
- [ ] Update version in `Cargo.toml`
- [ ] Update `CHANGELOG.md` with changes
- [ ] Run full test suite: `cargo test --all-features`
- [ ] Check formatting: `cargo fmt --all -- --check`
- [ ] Run clippy: `cargo clippy --all-targets --all-features -- -D warnings`
- [ ] Update documentation if needed
- [ ] Build docs: `cargo doc --no-deps`
- [ ] Test examples in README compile
- [ ] Create git tag: `git tag -a v0.1.0 -m "Release version 0.1.0"`
- [ ] Push tag: `git push origin v0.1.0`
- [ ] Publish to crates.io: `cargo publish`
## Post-Release
After publishing:
1. Create a GitHub release with the tag
2. Copy CHANGELOG entry to the release notes
3. Announce on relevant platforms if desired
## Versioning
This crate follows [Semantic Versioning](https://semver.org/):
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality additions
- PATCH version for backwards-compatible bug fixes
## CI/CD
GitHub Actions will automatically:
- Run tests on push/PR
- Check formatting
- Run clippy
- Build documentation
- Generate code coverage
Make sure all CI checks pass before merging PRs.