|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document describes how to create a new release for the Hype project using GoReleaser. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +### 1. Install GoReleaser |
| 8 | + |
| 9 | +```bash |
| 10 | +# Install via Homebrew (recommended on macOS) |
| 11 | +brew install goreleaser |
| 12 | + |
| 13 | +# Or install via Go |
| 14 | +go install github.com/goreleaser/goreleaser/v2@latest |
| 15 | +``` |
| 16 | + |
| 17 | +### 2. GitHub Token Setup |
| 18 | + |
| 19 | +You need a GitHub Personal Access Token with appropriate permissions: |
| 20 | + |
| 21 | +1. Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) |
| 22 | +2. Create a token with `repo` scope (for private repos) or `public_repo` scope (for public repos) |
| 23 | +3. Export it locally: |
| 24 | + |
| 25 | +```bash |
| 26 | +export GITHUB_TOKEN=your_token_here |
| 27 | +``` |
| 28 | + |
| 29 | +Tip: Add this to your `~/.zshrc` or `~/.bashrc` for persistence: |
| 30 | + |
| 31 | +```bash |
| 32 | +echo 'export GITHUB_TOKEN=your_token_here' >> ~/.zshrc |
| 33 | +``` |
| 34 | + |
| 35 | +## Release Methods |
| 36 | + |
| 37 | +### Method 1: Manual Release (Current Process) |
| 38 | + |
| 39 | +Use this method for immediate releases or if you prefer manual control: |
| 40 | + |
| 41 | +1. **Ensure you're on main branch and up to date:** |
| 42 | + |
| 43 | + ```bash |
| 44 | + git checkout main |
| 45 | + git pull origin main |
| 46 | + ``` |
| 47 | + |
| 48 | +2. **Verify all changes are committed:** |
| 49 | + |
| 50 | + ```bash |
| 51 | + git status |
| 52 | + # Should show "nothing to commit, working tree clean" |
| 53 | + ``` |
| 54 | + |
| 55 | +3. **Create and push the tag:** |
| 56 | + |
| 57 | + ```bash |
| 58 | + # Replace v0.3.2 with your desired version |
| 59 | + git tag v0.3.2 |
| 60 | + git push origin v0.3.2 |
| 61 | + ``` |
| 62 | + |
| 63 | +4. **Run GoReleaser:** |
| 64 | + |
| 65 | + ```bash |
| 66 | + goreleaser release --clean |
| 67 | + ``` |
| 68 | + |
| 69 | +### Method 2: Automated Release (Recommended for Future) |
| 70 | + |
| 71 | +If you want automated releases via GitHub Actions: |
| 72 | + |
| 73 | +1. **One-time setup - Commit the release workflow:** |
| 74 | + |
| 75 | + ```bash |
| 76 | + git add .github/workflows/release.yml |
| 77 | + git commit -m "Add automated release workflow" |
| 78 | + git push origin main |
| 79 | + ``` |
| 80 | + |
| 81 | +2. **For future releases, simply push a tag:** |
| 82 | + |
| 83 | + ```bash |
| 84 | + # Replace v0.3.3 with your desired version |
| 85 | + git tag v0.3.3 |
| 86 | + git push origin v0.3.3 |
| 87 | + ``` |
| 88 | + |
| 89 | + The GitHub Action will automatically run GoReleaser and create the release. |
| 90 | + |
| 91 | +## What Gets Created |
| 92 | + |
| 93 | +After a successful release, you'll have: |
| 94 | +
|
| 95 | +- A new release at `https://github.com/gopherguides/hype/releases/tag/v{version}` |
| 96 | +- Binaries for: |
| 97 | + - Linux (x86_64, ARM64) |
| 98 | + - Windows (x86_64) |
| 99 | + - macOS (x86_64, ARM64) |
| 100 | +- Automatically generated changelog |
| 101 | +- Downloadable archives for each platform (tar.gz for Unix, zip for Windows) |
| 102 | +
|
| 103 | +## Version Numbering |
| 104 | +
|
| 105 | +Follow semantic versioning (semver): |
| 106 | +
|
| 107 | +- `v1.0.0` - Major version (breaking changes) |
| 108 | +- `v0.1.0` - Minor version (new features, backwards compatible) |
| 109 | +- `v0.0.1` - Patch version (bug fixes, backwards compatible) |
| 110 | +
|
| 111 | +## Current Release Configuration |
| 112 | +
|
| 113 | +The release is configured via `.goreleaser.yaml`: |
| 114 | +
|
| 115 | +- Main binary: `./cmd/hype/main.go` |
| 116 | +- Builds for: Linux, Windows, macOS |
| 117 | +- Archives: tar.gz (Unix), zip (Windows) |
| 118 | +- Hooks: `go mod tidy` and `go generate ./...` before build |
| 119 | +
|
| 120 | +## Troubleshooting |
| 121 | +
|
| 122 | +### GoReleaser Command Not Found |
| 123 | +
|
| 124 | +```bash |
| 125 | +# Reinstall GoReleaser |
| 126 | +brew install goreleaser |
| 127 | +# Or |
| 128 | +go install github.com/goreleaser/goreleaser/v2@latest |
| 129 | +``` |
| 130 | +
|
| 131 | +### Invalid GitHub Token |
| 132 | +
|
| 133 | +```bash |
| 134 | +# Verify token is set |
| 135 | +echo $GITHUB_TOKEN |
| 136 | +# If empty, export it again |
| 137 | +export GITHUB_TOKEN=your_token_here |
| 138 | +``` |
| 139 | +
|
| 140 | +### Tag Already Exists |
| 141 | +
|
| 142 | +```bash |
| 143 | +# Delete local tag |
| 144 | +git tag -d v0.3.2 |
| 145 | +# Delete remote tag |
| 146 | +git push origin --delete v0.3.2 |
| 147 | +# Recreate tag |
| 148 | +git tag v0.3.2 |
| 149 | +git push origin v0.3.2 |
| 150 | +``` |
| 151 | +
|
| 152 | +### Build Failures |
| 153 | +
|
| 154 | +```bash |
| 155 | +# Test the build locally first |
| 156 | +goreleaser build --snapshot --clean |
| 157 | +``` |
| 158 | +
|
| 159 | +### Permission Denied |
| 160 | +
|
| 161 | +Ensure your GitHub token has the correct permissions: |
| 162 | +
|
| 163 | +- `public_repo` for public repositories |
| 164 | +- `repo` for private repositories |
| 165 | +
|
| 166 | +## Quick Reference |
| 167 | +
|
| 168 | +```bash |
| 169 | +# Complete release process (manual) |
| 170 | +git checkout main && git pull origin main |
| 171 | +git tag v0.3.2 |
| 172 | +git push origin v0.3.2 |
| 173 | +goreleaser release --clean |
| 174 | +
|
| 175 | +# Complete release process (automated, after workflow is set up) |
| 176 | +git checkout main && git pull origin main |
| 177 | +git tag v0.3.2 |
| 178 | +git push origin v0.3.2 |
| 179 | +# GitHub Actions handles the rest |
| 180 | +``` |
0 commit comments