|
| 1 | +# Release Guide |
| 2 | + |
| 3 | +This guide explains how to properly release new versions of Fishez using GitLab CI/CD. |
| 4 | + |
| 5 | +## Quick Release Process |
| 6 | + |
| 7 | +### 1. Run the automated release script |
| 8 | +```bash |
| 9 | +./scripts/release.sh 0.2.0 |
| 10 | +``` |
| 11 | + |
| 12 | +This will: |
| 13 | +- Update `Cargo.toml` version |
| 14 | +- Update `CHANGELOG.md` |
| 15 | +- Create a git tag |
| 16 | + |
| 17 | +### 2. Push changes to trigger CI/CD |
| 18 | +```bash |
| 19 | +git push origin main |
| 20 | +git push origin 0.2.0 |
| 21 | +``` |
| 22 | + |
| 23 | +### 3. Monitor GitLab CI |
| 24 | +- Go to: `https://gitlab.com/ioma8/fishez/-/pipelines` |
| 25 | +- Watch the release pipeline run automatically |
| 26 | +- The pipeline will build and create the release |
| 27 | + |
| 28 | +### 4. Verify release |
| 29 | +- Go to: `https://gitlab.com/ioma8/fishez/-/releases` |
| 30 | +- Check that the release was created successfully |
| 31 | +- Download the binary if needed |
| 32 | + |
| 33 | +## Manual Release Process |
| 34 | + |
| 35 | +### Step 1: Update Version in Cargo.toml |
| 36 | +```toml |
| 37 | +version = "0.2.0" # Change from "0.1.0" to new version |
| 38 | +``` |
| 39 | + |
| 40 | +### Step 2: Update CHANGELOG.md |
| 41 | +```markdown |
| 42 | +## [Unreleased] |
| 43 | + |
| 44 | +### Added |
| 45 | +- New features for this version |
| 46 | + |
| 47 | +## [0.2.0] - 2024-02-16 |
| 48 | + |
| 49 | +### Added |
| 50 | +- Feature 1 |
| 51 | +- Feature 2 |
| 52 | + |
| 53 | +[Unreleased]: https://github.com/ioma8/fishez/compare/v0.2.0...HEAD |
| 54 | +[0.2.0]: https://github.com/ioma8/fishez/releases/tag/v0.2.0 |
| 55 | +``` |
| 56 | + |
| 57 | +### Step 3: Create and Push Tag |
| 58 | +```bash |
| 59 | +git tag -a 0.2.0 -m "Release fishez 0.2.0" |
| 60 | +git push origin 0.2.0 |
| 61 | +``` |
| 62 | + |
| 63 | +### Step 4: Update README.md (Optional) |
| 64 | +If needed, update version numbers in the README. |
| 65 | + |
| 66 | +## Understanding the CI/CD Pipeline |
| 67 | + |
| 68 | +### Pipeline Stages |
| 69 | +1. **Test**: Unit tests and integration tests |
| 70 | +2. **Quality**: Clippy, fmt, tree check, binary size |
| 71 | +3. **Build**: Release binary compilation |
| 72 | +4. **Docs**: HTML documentation generation |
| 73 | +5. **Security**: Vulnerability scanning |
| 74 | +6. **Release**: Automated release creation |
| 75 | + |
| 76 | +### What Gets Created |
| 77 | +- **Binary**: `target/release/fishez` (uploaded as release asset) |
| 78 | +- **Documentation**: `target/doc/` (uploaded as release asset) |
| 79 | +- **GitLab Release**: Created automatically with tag |
| 80 | + |
| 81 | +### Release Artifacts |
| 82 | +- **Binary**: Executable for your OS |
| 83 | +- **Documentation**: HTML docs with `index.html` |
| 84 | + |
| 85 | +## After Release |
| 86 | + |
| 87 | +### 1. Update README.md |
| 88 | +Update version references and any feature lists if changed. |
| 89 | + |
| 90 | +### 2. Commit and Push |
| 91 | +```bash |
| 92 | +git add . |
| 93 | +git commit -m "Prepare release v0.2.0" |
| 94 | +git push origin main |
| 95 | +``` |
| 96 | + |
| 97 | +### 3. Verify Release on GitHub/GitLab |
| 98 | +- Check that all tests pass |
| 99 | +- Verify the release page looks correct |
| 100 | +- Test downloading the binary if needed |
| 101 | + |
| 102 | +### 4. Update Unreleased Section |
| 103 | +```bash |
| 104 | +# After release, update CHANGELOG.md: |
| 105 | +sed -i.bak 's/\[Unreleased\]/[0.2.0] - $(date +%Y-%m-%d)/' CHANGELOG.md |
| 106 | +rm CHANGELOG.md.bak |
| 107 | +``` |
| 108 | + |
| 109 | +## Troubleshooting |
| 110 | + |
| 111 | +### Tag not triggering release |
| 112 | +- Check that the tag name matches the version exactly (e.g., `0.2.0` not `v0.2.0`) |
| 113 | +- Verify the tag was pushed: `git ls-remote --tags origin` |
| 114 | +- Check GitLab CI logs for errors |
| 115 | + |
| 116 | +### Build failures |
| 117 | +- Run local: `make release-ci` |
| 118 | +- Check for compilation errors |
| 119 | +- Review CI logs for specific failures |
| 120 | + |
| 121 | +### Release not created |
| 122 | +- Verify all pipeline stages pass |
| 123 | +- Check that the release stage has a tag ref |
| 124 | +- Ensure release assets are being uploaded |
| 125 | + |
| 126 | +## Best Practices |
| 127 | + |
| 128 | +1. **Semantic Versioning**: Follow MAJOR.MINOR.PATCH format |
| 129 | +2. **Test Thoroughly**: Run tests before releasing |
| 130 | +3. **Update Changelog**: Document all changes |
| 131 | +4. **Tag Immediately**: Create tag right after version change |
| 132 | +5. **Push Both**: Push both main branch and tag |
| 133 | +6. **Review CI**: Check all pipeline stages pass |
| 134 | +7. **Binary Test**: Verify binary works on your system |
| 135 | + |
| 136 | +## Rollback Procedure |
| 137 | + |
| 138 | +If a release needs to be reverted: |
| 139 | + |
| 140 | +```bash |
| 141 | +# Delete the release from GitLab (via web interface) |
| 142 | +# Delete the tag |
| 143 | +git tag -d 0.2.0 |
| 144 | +git push origin :refs/tags/0.2.0 |
| 145 | + |
| 146 | +# Reset version in Cargo.toml |
| 147 | +# Revert CHANGELOG.md |
| 148 | +``` |
| 149 | + |
| 150 | +## Creating a Pre-release |
| 151 | + |
| 152 | +For testing before official release: |
| 153 | + |
| 154 | +```bash |
| 155 | +# Use pre-release version suffix (e.g., 0.2.0-alpha.1) |
| 156 | +./scripts/release.sh 0.2.0-alpha.1 |
| 157 | + |
| 158 | +# Push tag |
| 159 | +git push origin 0.2.0-alpha.1 |
| 160 | +``` |
| 161 | + |
| 162 | +## Checking Pipeline Status |
| 163 | + |
| 164 | +```bash |
| 165 | +# Check pipeline status |
| 166 | +curl -s "https://gitlab.com/api/v4/projects/ioma8%2Ffishez/pipelines?ref=main" \ |
| 167 | + -H "PRIVATE-TOKEN: <your_token>" | jq |
| 168 | + |
| 169 | +# Or visit: https://gitlab.com/ioma8/fishez/-/pipelines |
| 170 | +``` |
| 171 | + |
| 172 | +## References |
| 173 | + |
| 174 | +- [GitLab CI/CD Documentation](https://docs.gitlab.com/ee/ci/) |
| 175 | +- [Semantic Versioning](https://semver.org/) |
| 176 | +- [Rust Release Process](https://doc.rust-lang.org/cargo/guide/releasing.html) |
0 commit comments