This document describes how to create a new release of SlimJSON.
Prerequisites
- All tests must pass
- Documentation is up to date
- CHANGELOG.md is updated with release notes
- You have push access to the repository
Release Steps
1. Update Version Information
Update CHANGELOG.md:
## [1.0.0] - 2024-01-15
### Added
- Feature 1
- Feature 2
### Changed
- Change 1
### Fixed
- Bug fix 1
2. Commit Changes
git add CHANGELOG.md
git commit -m "chore: prepare release v1.0.0"
git push origin main
3. Create and Push Tag
# Create annotated tag
git tag -a v1.0.0 -m "Release v1.0.0"
# Push tag to GitHub
git push origin v1.0.0
4. Automated Release Process
Once the tag is pushed, GitHub Actions will automatically:
- ✅ Run all tests
- ✅ Run golangci-lint
- ✅ Build binaries for:
- linux/amd64
- linux/arm64
- darwin/amd64
- darwin/arm64
- freebsd/amd64
- freebsd/arm64
- ✅ Create GitHub Release with:
- Release notes from CHANGELOG.md
- Binary artifacts
- SHA256 checksums
- ✅ Publish to pkg.go.dev
- ✅ Build and push Docker images to ghcr.io
5. Verify Release
After the GitHub Action completes (usually 5-10 minutes):
Check GitHub Release
# Visit GitHub releases page
https://github.com/tradik/slimjson/releases
Verify:
- ✅ Release notes are correct
- ✅ All binary artifacts are present
- ✅ SHA256 checksums are generated
Check pkg.go.dev
# Visit pkg.go.dev
https://pkg.go.dev/github.com/tradik/slimjson@v1.0.0
Verify:
- ✅ Documentation is rendered correctly
- ✅ Version is listed
- ✅ Examples are visible
Note: pkg.go.dev may take 5-15 minutes to index the new version.
Check Docker Image
# Pull the image
docker pull ghcr.io/tradik/slimjson:v1.0.0
docker pull ghcr.io/tradik/slimjson:latest
# Test the image
docker run --rm ghcr.io/tradik/slimjson:v1.0.0 --help
Test Installation
# Create a test directory
mkdir /tmp/test-slimjson
cd /tmp/test-slimjson
# Initialize Go module
go mod init test
# Install the new version
go get github.com/tradik/slimjson@v1.0.0
# Verify it works
cat > main.go << 'EOF'
package main
import (
"encoding/json"
"fmt"
"github.com/tradik/slimjson"
)
func main() {
data := map[string]interface{}{
"test": "data",
"list": []interface{}{1, 2, 3, 4, 5},
}
cfg := slimjson.Config{
MaxListLength: 3,
StripEmpty: true,
}
slimmer := slimjson.New(cfg)
result := slimmer.Slim(data)
out, _ := json.MarshalIndent(result, "", " ")
fmt.Println(string(out))
}
EOF
go run main.go
6. Announce Release
After verification, announce the release:
- GitHub Discussions (if enabled)
- Twitter/Social Media
- Go Community (reddit.com/r/golang)
- Project Users (if applicable)
Version Numbering
SlimJSON follows Semantic Versioning:
- MAJOR version (v1.0.0 → v2.0.0): Incompatible API changes
- MINOR version (v1.0.0 → v1.1.0): New functionality, backwards compatible
- PATCH version (v1.0.0 → v1.0.1): Bug fixes, backwards compatible
Pre-release Versions
For testing before official release:
# Create pre-release tag
git tag -a v1.0.0-rc.1 -m "Release candidate 1"
git push origin v1.0.0-rc.1
Pre-release versions:
v1.0.0-alpha.1- Alpha releasev1.0.0-beta.1- Beta releasev1.0.0-rc.1- Release candidate
Hotfix Process
For urgent bug fixes:
- Create hotfix branch from tag:
git checkout -b hotfix/v1.0.1 v1.0.0 - Make fixes and commit:
git commit -m "fix: critical bug" -
Update CHANGELOG.md
- Create tag:
git tag -a v1.0.1 -m "Hotfix v1.0.1" - Push branch and tag:
git push origin hotfix/v1.0.1 git push origin v1.0.1 - Merge back to main:
git checkout main git merge hotfix/v1.0.1 git push origin main
Rollback
If a release has critical issues:
- Delete the tag (if not widely used):
git tag -d v1.0.0 git push origin :refs/tags/v1.0.0 - Create a new patch release (if already in use):
# Fix the issue git commit -m "fix: critical issue" # Create new version git tag -a v1.0.1 -m "Fix for v1.0.0" git push origin v1.0.1
Troubleshooting
pkg.go.dev not updating
# Manually trigger update
curl "https://proxy.golang.org/github.com/tradik/slimjson/@v/v1.0.0.info"
# Wait 5-15 minutes and check again
GitHub Action fails
- Check the Actions tab on GitHub
- Review the error logs
- Fix the issue
- Delete the tag and recreate:
git tag -d v1.0.0 git push origin :refs/tags/v1.0.0 git tag -a v1.0.0 -m "Release v1.0.0" git push origin v1.0.0
Binary artifacts missing
- Check if the build job completed successfully
- Verify the matrix configuration in
.github/workflows/release.yml - Re-run the failed jobs from GitHub Actions UI
Checklist
Before creating a release, verify:
- All tests pass locally (
go test ./...) - golangci-lint passes (
golangci-lint run) - Documentation is updated
- README.md
- LIBRARY_EXAMPLES.md
- doc.go
- api/README.md
- api/swagger.yaml
- CHANGELOG.md has release notes
- Version number follows semver
- No uncommitted changes
- On main branch
- All CI checks pass on main
Post-Release
After successful release:
- Verify GitHub Release
- Verify pkg.go.dev
- Verify Docker images
- Test installation
- Update project board (if applicable)
- Announce release
- Close related issues/PRs