|
| 1 | +# Freenet Release Recovery Guide |
| 2 | + |
| 3 | +When the release script fails mid-process, use this guide to complete the release manually. |
| 4 | + |
| 5 | +## Quick Reference |
| 6 | + |
| 7 | +```bash |
| 8 | +# Check current state |
| 9 | +gh pr view <PR_NUMBER> --json state,mergedAt |
| 10 | +git tag -l "v*" | tail -5 |
| 11 | +gh release list --limit 5 |
| 12 | +cargo search freenet --limit 1 |
| 13 | + |
| 14 | +# Resume from where you left off |
| 15 | +# See detailed steps below based on where the failure occurred |
| 16 | +``` |
| 17 | + |
| 18 | +## Release Steps & Recovery |
| 19 | + |
| 20 | +### Step 1: PR Created but Not Merged |
| 21 | + |
| 22 | +**Symptoms:** |
| 23 | +- PR exists but isn't merged |
| 24 | +- CI may be failing |
| 25 | + |
| 26 | +**Recovery:** |
| 27 | +1. Fix any CI failures |
| 28 | +2. If conventional commits check failed: |
| 29 | + ```bash |
| 30 | + gh pr edit <PR_NUMBER> --title "chore: release X.Y.Z" |
| 31 | + ``` |
| 32 | +3. If other CI failures, fix code and push to release branch |
| 33 | +4. Wait for PR to auto-merge or merge manually |
| 34 | + |
| 35 | +### Step 2: PR Merged but Tag Not Created |
| 36 | + |
| 37 | +**Symptoms:** |
| 38 | +- PR is merged to main |
| 39 | +- No git tag exists for version |
| 40 | + |
| 41 | +**Recovery:** |
| 42 | +```bash |
| 43 | +cd ~/code/freenet/freenet-core/main |
| 44 | +git pull origin main |
| 45 | +git tag v0.1.X |
| 46 | +git push origin v0.1.X |
| 47 | +``` |
| 48 | + |
| 49 | +### Step 3: Tag Created but GitHub Release Missing |
| 50 | + |
| 51 | +**Symptoms:** |
| 52 | +- Git tag exists |
| 53 | +- No GitHub release |
| 54 | + |
| 55 | +**Recovery:** |
| 56 | +```bash |
| 57 | +gh release create v0.1.X \ |
| 58 | + --repo freenet/freenet-core \ |
| 59 | + --title "v0.1.X" \ |
| 60 | + --notes "$(gh api repos/freenet/freenet-core/releases/generate-notes \ |
| 61 | + -f tag_name=v0.1.X -f target_commitish=main --jq .body)" |
| 62 | +``` |
| 63 | + |
| 64 | +### Step 4: Release Created but Crates Not Published |
| 65 | + |
| 66 | +**Symptoms:** |
| 67 | +- GitHub release exists |
| 68 | +- Crates not on crates.io |
| 69 | + |
| 70 | +**Recovery:** |
| 71 | +```bash |
| 72 | +cd ~/code/freenet/freenet-core/main |
| 73 | +git pull origin main |
| 74 | + |
| 75 | +# Publish freenet crate |
| 76 | +cargo publish -p freenet |
| 77 | + |
| 78 | +# Publish fdev crate |
| 79 | +cargo publish -p fdev |
| 80 | + |
| 81 | +# Verify |
| 82 | +cargo search freenet --limit 1 |
| 83 | +``` |
| 84 | + |
| 85 | +### Step 5: Crates Published but Local Not Deployed |
| 86 | + |
| 87 | +**Symptoms:** |
| 88 | +- Everything published |
| 89 | +- Local gateway not updated |
| 90 | + |
| 91 | +**Recovery:** |
| 92 | +```bash |
| 93 | +cd ~/code/freenet/freenet-core/main |
| 94 | +cargo build --release --bin freenet |
| 95 | + |
| 96 | +# Deploy to gateway only |
| 97 | +./scripts/deploy-local-gateway.sh |
| 98 | + |
| 99 | +# Deploy to all instances (gateway + 10 peers) |
| 100 | +./scripts/deploy-local-gateway.sh --all-instances |
| 101 | +``` |
| 102 | + |
| 103 | +### Step 6: Deployed but Matrix Not Announced |
| 104 | + |
| 105 | +**Symptoms:** |
| 106 | +- Release complete |
| 107 | +- No Matrix announcement |
| 108 | + |
| 109 | +**Recovery:** |
| 110 | +```bash |
| 111 | +matrix-commander -r '#freenet-locutus:matrix.org' -m "🎉 **Freenet v0.1.X Released!** |
| 112 | +
|
| 113 | +📦 Published to crates.io: |
| 114 | + • freenet v0.1.X |
| 115 | + • fdev v0.Y.Z |
| 116 | +
|
| 117 | +🔗 Release: https://github.com/freenet/freenet-core/releases/tag/v0.1.X |
| 118 | +
|
| 119 | +[AI-assisted release announcement]" |
| 120 | +``` |
| 121 | + |
| 122 | +## Common Issues |
| 123 | + |
| 124 | +### Issue: "Text file busy" during deployment |
| 125 | + |
| 126 | +**Cause:** Systemd services have `Restart=always` and keep respawning |
| 127 | + |
| 128 | +**Solution:** |
| 129 | +```bash |
| 130 | +# Stop all services and disable auto-restart |
| 131 | +sudo systemctl stop freenet-gateway freenet-peer-{01..10} |
| 132 | +sudo systemctl disable freenet-gateway freenet-peer-{01..10} |
| 133 | + |
| 134 | +# Wait for binary to be released |
| 135 | +while sudo lsof /usr/local/bin/freenet; do sleep 1; done |
| 136 | + |
| 137 | +# Deploy new binary |
| 138 | +sudo rm /usr/local/bin/freenet |
| 139 | +sudo cp target/release/freenet /usr/local/bin/freenet |
| 140 | + |
| 141 | +# Re-enable and start |
| 142 | +sudo systemctl enable freenet-gateway freenet-peer-{01..10} |
| 143 | +sudo systemctl start freenet-gateway freenet-peer-{01..10} |
| 144 | +``` |
| 145 | + |
| 146 | +### Issue: Conventional Commits CI failure |
| 147 | + |
| 148 | +**Cause:** PR title doesn't follow conventional commit format |
| 149 | + |
| 150 | +**Solution:** |
| 151 | +```bash |
| 152 | +gh pr edit <PR_NUMBER> --title "chore: release X.Y.Z" |
| 153 | + |
| 154 | +# Trigger CI rerun |
| 155 | +git checkout release/vX.Y.Z |
| 156 | +git commit --allow-empty -m "chore: trigger CI rerun" |
| 157 | +git push origin release/vX.Y.Z |
| 158 | +``` |
| 159 | + |
| 160 | +### Issue: Crates.io publishing fails |
| 161 | + |
| 162 | +**Cause:** Version already published, credentials issue, or dependency problems |
| 163 | + |
| 164 | +**Solution:** |
| 165 | +```bash |
| 166 | +# Check if already published |
| 167 | +cargo search freenet --limit 1 |
| 168 | + |
| 169 | +# Verify credentials |
| 170 | +cargo login |
| 171 | + |
| 172 | +# Check for dependency issues |
| 173 | +cargo package --list -p freenet |
| 174 | +cargo publish --dry-run -p freenet |
| 175 | +``` |
| 176 | + |
| 177 | +## Full Manual Release Process |
| 178 | + |
| 179 | +If you need to do everything manually: |
| 180 | + |
| 181 | +```bash |
| 182 | +# 1. Create PR and merge |
| 183 | +cd ~/code/freenet/freenet-core/main |
| 184 | +# Edit Cargo.toml versions manually |
| 185 | +git checkout -b release/v0.1.X |
| 186 | +git add -A |
| 187 | +git commit -m "chore: release 0.1.X" |
| 188 | +git push origin release/v0.1.X |
| 189 | +gh pr create --title "chore: release 0.1.X" --body "Release v0.1.X" --base main |
| 190 | + |
| 191 | +# 2. Wait for CI and merge (or use gh pr merge --auto) |
| 192 | + |
| 193 | +# 3. Create tag |
| 194 | +git checkout main |
| 195 | +git pull |
| 196 | +git tag v0.1.X |
| 197 | +git push origin v0.1.X |
| 198 | + |
| 199 | +# 4. Create GitHub release |
| 200 | +gh release create v0.1.X --repo freenet/freenet-core --generate-notes |
| 201 | + |
| 202 | +# 5. Publish crates |
| 203 | +cargo publish -p freenet |
| 204 | +cargo publish -p fdev |
| 205 | + |
| 206 | +# 6. Deploy locally |
| 207 | +cargo build --release --bin freenet |
| 208 | +./scripts/deploy-local-gateway.sh --all-instances |
| 209 | + |
| 210 | +# 7. Announce to Matrix |
| 211 | +matrix-commander -r '#freenet-locutus:matrix.org' -m "..." |
| 212 | +``` |
| 213 | + |
| 214 | +## Rollback |
| 215 | + |
| 216 | +If you need to rollback a release: |
| 217 | + |
| 218 | +```bash |
| 219 | +./scripts/release-rollback.sh --version 0.1.X |
| 220 | + |
| 221 | +# To also yank from crates.io (cannot be undone!) |
| 222 | +./scripts/release-rollback.sh --version 0.1.X --yank-crates |
| 223 | +``` |
| 224 | + |
| 225 | +## Verification Checklist |
| 226 | + |
| 227 | +After recovery, verify: |
| 228 | + |
| 229 | +- [ ] PR merged: `gh pr view <NUMBER> --json state` |
| 230 | +- [ ] Tag exists: `git tag -l "v0.1.X"` |
| 231 | +- [ ] GitHub release: `gh release view v0.1.X` |
| 232 | +- [ ] Crates published: `cargo search freenet --limit 1` |
| 233 | +- [ ] Local gateway updated: `/usr/local/bin/freenet --version` |
| 234 | +- [ ] Services running: `systemctl status freenet-gateway freenet-peer-01` |
| 235 | +- [ ] Matrix announced: Check #freenet-locutus channel |
0 commit comments