# Release Process

This guide outlines the process for releasing new versions of Crypto Trader.

## Version Numbering

Follow [Semantic Versioning](https://semver.org/):

- **MAJOR**: Breaking changes
- **MINOR**: New features (backward compatible)
- **PATCH**: Bug fixes (backward compatible)

Example: `1.2.3`

## Release Checklist

### Pre-Release

- [ ] All tests passing
- [ ] Code coverage meets threshold (95%)
- [ ] Documentation is up to date
- [ ] Changelog is updated
- [ ] Version number updated
- [ ] All issues for milestone are closed

### Release Steps

1. **Update Version**

   Update version in:
   - `setup.py`
   - `docs/api/source/conf.py`
   - `src/__init__.py` (if exists)

2. **Update Changelog**

   Document all changes in `CHANGELOG.md`:
   - Added features
   - Changed features
   - Deprecated features
   - Removed features
   - Fixed bugs
   - Security updates

3. **Create Release Branch**

   ```bash
   git checkout -b release/v1.2.3
   git push origin release/v1.2.3
   ```

4. **Build and Test**

   ```bash
   # Run all tests
   pytest
   
   # Build AppImage
   ./packaging/build_appimage.sh
   
   # Test AppImage
   ./crypto_trader-*.AppImage --test
   ```

5. **Create Release Tag**

   ```bash
   git tag -a v1.2.3 -m "Release v1.2.3"
   git push origin v1.2.3
   ```

6. **Create GitHub Release**

   - Create release on GitHub
   - Upload AppImage
   - Add release notes from changelog
   - Mark as latest release

7. **Merge to Main**

   ```bash
   git checkout main
   git merge release/v1.2.3
   git push origin main
   ```

## AppImage Release

### Building AppImage

```bash
cd packaging
./build_appimage.sh
```

### AppImage Requirements

- Must be executable
- Must include all dependencies
- Must be tested on target system
- Must include version in filename

### AppImage Distribution

- Upload to GitHub Releases
- Include checksums (SHA256)
- Provide installation instructions
- Test on clean system

## Post-Release

1. **Announce Release**

   - Update website (if applicable)
   - Post release notes
   - Notify users

2. **Monitor**

   - Watch for issues
   - Monitor error reports
   - Track download statistics

3. **Hotfixes**

   If critical bugs are found:
   - Create hotfix branch
   - Fix and test
   - Release patch version
   - Merge to main

## Release Notes Template

```markdown
# Release v1.2.3

## Added
- New feature X
- New feature Y

## Changed
- Improved performance of Z
- Updated dependency versions

## Fixed
- Fixed bug in A
- Fixed issue with B

## Security
- Security update for C

## Installation

Download the AppImage:
- [crypto_trader-1.2.3-x86_64.AppImage](link)

SHA256: [checksum]

## Upgrade Notes

[Any upgrade instructions]
```

## Emergency Releases

For critical security or stability issues:

1. Create hotfix branch from latest release
2. Apply fix
3. Test thoroughly
4. Release immediately
5. Merge to main and develop

## Version History

Maintain version history in:
- `CHANGELOG.md`
- GitHub Releases
- Documentation

