legion-server 0.1.0

🏛️ Legion Server - Secure IRC server with Legion Protocol support
# Legion Protocol Ecosystem - Release Guide

This guide covers how to release the Legion Protocol ecosystem crates to production.

## 🏗️ Setup Requirements

### 1. Add GitHub Secrets

You need to add your crates.io API token to each repository's GitHub secrets:

**For each repository (phalanx, legion-protocol, centurion, legionnaire):**

```bash
# Using GitHub CLI (recommended)
gh secret set CARGO_REGISTRY_TOKEN --body "YOUR_CRATES_IO_TOKEN" --repo exec/phalanx
gh secret set CARGO_REGISTRY_TOKEN --body "YOUR_CRATES_IO_TOKEN" --repo exec/legion-protocol  
gh secret set CARGO_REGISTRY_TOKEN --body "YOUR_CRATES_IO_TOKEN" --repo exec/centurion
gh secret set CARGO_REGISTRY_TOKEN --body "YOUR_CRATES_IO_TOKEN" --repo exec/legionnaire
```

**Or manually via GitHub web interface:**
1. Go to `https://github.com/exec/[REPO_NAME]/settings/secrets/actions`
2. Click "New repository secret"
3. Name: `CARGO_REGISTRY_TOKEN`
4. Value: `YOUR_CRATES_IO_TOKEN`

### 2. Verify Crate Ownership

Make sure you own the crate names on crates.io:
- `phalanx`
- `legion-protocol` 
- `centurion`
- `legionnaire`

If any are taken, you'll need to choose different names.

## 📦 Release Process

### Release Order (IMPORTANT!)

Due to dependencies, you MUST release in this exact order:

1. **phalanx** (no dependencies)
2. **legion-protocol** (no dependencies) 
3. **legion-server** (depends on phalanx + legion-protocol)
4. **legionnaire** (depends on phalanx + legion-protocol)

### Using the Release Script

```bash
# 1. Release phalanx first
./release.sh phalanx 0.1.0

# 2. Wait for phalanx to be published, then release legion-protocol
./release.sh legion-protocol 0.1.0

# 3. Wait for legion-protocol to be published, then release centurion
./release.sh legion-server 0.1.0

# 4. Finally, release legionnaire
./release.sh legionnaire 0.1.1
```

### Manual Release Process

If you prefer to do it manually:

```bash
# 1. Update version in Cargo.toml
sed -i 's/version = "0.1.0"/version = "0.1.1"/' Cargo.toml

# 2. Test everything works
cargo test --all-features
cargo check --all-features

# 3. Commit and tag
git add Cargo.toml
git commit -m "bump: Release v0.1.1"
git tag v0.1.1

# 4. Push to trigger CI
git push origin main
git push origin v0.1.1
```

## 🔄 Development Workflow

### Switch Between Local and Production Dependencies

```bash
# For local development (edit dependencies locally)
./dev-setup.sh local

# For production builds (use published crates)
./dev-setup.sh production
```

### Development Cycle

1. **Local Development**: Use `./dev-setup.sh local` to work with local dependencies
2. **Before Release**: Use `./dev-setup.sh production` to test with published crates
3. **Release**: Follow the release order above
4. **Back to Development**: Use `./dev-setup.sh local` to continue development

## 🚀 What Happens During Release

When you push a tag (e.g., `v0.1.0`), GitHub Actions will:

1. **Run Tests** - Ensure everything passes
2. **Publish to crates.io** - Make the crate available publicly
3. **Build Binaries** (legionnaire only) - Create release binaries for multiple platforms
4. **Create GitHub Release** (legionnaire only) - Upload binaries and release notes

## 📋 Post-Release Checklist

After each release:

- [ ] Verify the crate appears on crates.io
- [ ] Check that the GitHub Action succeeded
- [ ] Test installing: `cargo install [crate-name]`
- [ ] Update dependent crates to use the new version

## 🐛 Troubleshooting

### "Crate already exists" Error
- You need to own the crate name on crates.io
- Or choose a different name and update all references

### "Version already exists" Error  
- You've already published this version
- Bump the version number and try again

### GitHub Actions Failing
- Check the logs at `https://github.com/exec/[REPO]/actions`
- Ensure `CARGO_REGISTRY_TOKEN` secret is set correctly
- Verify all tests pass locally first

### Dependency Resolution Issues
- Make sure to release in the correct order
- Wait for crates to appear on crates.io before releasing dependent crates
- Use `./dev-setup.sh production` to test with published dependencies

## 🔗 Useful Commands

```bash
# Check what's published
cargo search legion-protocol
cargo search phalanx
cargo search legion-server  
cargo search legionnaire

# Install from crates.io
cargo install legionnaire
cargo install legion-server

# Check dependency tree
cargo tree

# Dry run publish (test without actually publishing)
cargo publish --dry-run
```