@@ -483,7 +483,18 @@ func TestConverterConvert(t *testing.T) { ... }
483483
484484# ## Creating a new release
485485
486+ **Release Infrastructure:**
487+
488+ This repository uses **GoReleaser** with **GitHub Actions** to automate binary builds and Homebrew publishing.
489+ The recommended workflow is :
490+
491+ 1. Create a GitHub Release with detailed notes using `gh release create`
492+ 2. GoReleaser automatically triggers, adds binaries to your release, and publishes to Homebrew
493+
494+ This approach maintains full control over release notes while automating the build and distribution process.
495+
486496**Prerequisites:**
497+
4874981. Ensure you are on the `main` branch
4884992. Ensure your local `main` is up-to-date with `origin/main`
4895003. Verify all tests pass : ` make check`
@@ -506,14 +517,88 @@ The version tag follows the format `vMAJOR.MINOR.PATCH` (e.g., `v1.7.0`):
506517 - Use when : Removing/changing public APIs, incompatible changes
507518 - Note : Major version bumps require careful planning and are extremely rare
508519
509- **Release Process:**
520+ **GitHub Personal Access Token (PAT) Setup:**
521+
522+ **REQUIRED:** The automated release workflow needs a Personal Access Token to push to the Homebrew tap repository.
523+
524+ The default `GITHUB_TOKEN` provided by GitHub Actions only has permissions for the current repository and
525+ **cannot** push to the separate `homebrew-oastools` repository. You must create a PAT with `repo` scope.
526+
527+ **For Automated Releases (GitHub Actions) - REQUIRED SETUP:**
528+
529+ 1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
530+ 2. Click "Generate new token (classic)"
531+ 3. Set a descriptive name (e.g., "GoReleaser - oastools Homebrew Publishing")
532+ 4. Select scopes : **`repo`** (full control of private repositories)
533+ 5. Click "Generate token" and **copy the token immediately** (you won't be able to see it again)
534+ 6. Go to the oastools repository → Settings → Secrets and variables → Actions
535+ 7. Click "New repository secret"
536+ 8. Name : ` HOMEBREW_TAP_TOKEN`
537+ 9. Value : Paste the token you copied
538+ 10. Click "Add secret"
539+
540+ The `.github/workflows/release.yml` file is already configured to use `${{ secrets.HOMEBREW_TAP_TOKEN }}`.
541+
542+ **Verify PAT Setup:**
543+
544+ Before creating your first release, verify the PAT secret is configured :
545+ ` ` ` bash
546+ gh secret list --repo erraggy/oastools
547+ ` ` `
548+
549+ You should see `HOMEBREW_TAP_TOKEN` in the list.
550+
551+ **For Local Releases:**
552+
553+ If you prefer to run releases locally (not recommended), you'll need to use the same PAT :
554+
555+ 1. Create a PAT as described above (or use the same one)
556+ 2. Export it in your shell :
557+ ` ` ` bash
558+ export GITHUB_TOKEN="ghp_your_token_here"
559+ ` ` `
560+ 3. Use the `make release-test` target to test locally before running a real release
561+
562+ **IMPORTANT:** Never commit the PAT to git. Keep it secure in GitHub Secrets or your local environment only.
563+
564+ **Release Make Targets:**
565+
566+ The following make targets are available to help with testing :
567+
568+ ` ` ` bash
569+ # Test the GoReleaser configuration locally (no publishing)
570+ make release-test
571+
572+ # Clean up local release artifacts
573+ make release-clean
574+ ` ` `
575+
576+ **Pre-Release Checklist:**
577+
578+ Before creating your first release, ensure :
579+ - [ ] `HOMEBREW_TAP_TOKEN` secret is created and added to repository secrets
580+ - [ ] Secret verified with : ` gh secret list --repo erraggy/oastools`
581+ - [ ] Local test successful : ` make release-test`
582+ - [ ] Commit author email in `.goreleaser.yaml` matches a verified email in your GitHub account
583+ - [ ] All changes committed and pushed to `main`
584+ - [ ] All tests pass : ` make check`
585+
586+ **Release Process (Recommended Workflow):**
510587
511- 1. **Determine the version number** based on the changes included (see rules above)
588+ This workflow creates the GitHub Release first with detailed notes, then GoReleaser adds binaries and publishes to Homebrew.
512589
513- 2. **Create the release using `gh release create`:**
590+ 1. **Determine the version number** based on the changes included (see SemVer rules above)
591+
592+ 2. **Test the release configuration locally** (optional but recommended) :
514593 ` ` ` bash
515- gh release create v1.7.0 \
516- --title "v1.7.0 - Brief summary within 72 chars" \
594+ make release-test
595+ ` ` `
596+ This runs GoReleaser in snapshot mode to verify everything builds correctly without publishing.
597+
598+ 3. **Create the GitHub Release with detailed notes** :
599+ ` ` ` bash
600+ gh release create v1.7.1 \
601+ --title "v1.7.1 - Brief summary within 72 chars" \
517602 --notes "$(cat <<'EOF'
518603 ## Summary
519604
@@ -538,55 +623,70 @@ The version tag follows the format `vMAJOR.MINOR.PATCH` (e.g., `v1.7.0`):
538623
539624 - #17 - PR title
540625 - #18 - PR title
541- EOF
542- )"
543- ` ` `
544-
545- 3. **Title format** : ` vX.Y.Z - Brief summary` (keep within 72 characters total)
546- - Example : ` v1.7.0 - Performance improvements and benchmark suite`
547-
548- 4. **Body format** : Well-formatted markdown with:
549- - **Summary**: High-level overview of the release
550- - **What's New**: Bullet points of new features/improvements
551- - **Changes**: Notable changes or fixes
552- - **Technical Details**: Benchmarks, metrics, migration notes (if applicable)
553- - **Related PRs**: Links to merged pull requests
554626
555- **Example Release Command:**
627+ ## Installation
556628
557- ` ` ` bash
558- gh release create v1.7.0 \
559- --title "v1.7.0 - Performance improvements and benchmark suite" \
560- --notes "$(cat <<'EOF'
561- ## Summary
562-
563- This release introduces comprehensive performance benchmarking infrastructure
564- and delivers significant JSON marshaling performance improvements.
565-
566- ## What's New
567-
568- - Comprehensive benchmark suite (60+ benchmarks across all packages)
569- - JSON marshaler optimization (25-32% faster, 29-37% fewer allocations)
570- - Performance improvement planning documentation
571-
572- ## Performance Improvements
573-
574- - Info marshaling: 26% faster (2,323ns → 1,707ns)
575- - Contact marshaling: 32% faster (2,336ns → 1,599ns)
576- - Server marshaling: 25% faster (2,837ns → 2,160ns)
629+ ### Homebrew
630+ ` ` ` bash
631+ brew tap erraggy/oastools
632+ brew install oastools
633+ ` ` `
577634
578- ## Related PRs
635+ ### Binary Download
636+ Download the appropriate binary for your platform from the assets below.
637+ EOF
638+ )"
639+ ` ` `
579640
580- - #17 - Phase 1: Benchmark infrastructure and baseline
581- - #18 - Phase 2: JSON marshaler optimization
582- EOF
583- )"
584- ` ` `
641+ **Important:** The `gh release create` command automatically:
642+ - Creates the version tag (e.g., `v1.7.1`)
643+ - Creates the GitHub Release with your detailed notes
644+ - Triggers the GitHub Actions workflow
645+
646+ 4. **Monitor the automated build** :
647+ The GitHub Actions workflow will automatically :
648+ - Build binaries for all platforms (Linux, macOS, Windows)
649+ - Add binary archives to your GitHub Release
650+ - Publish the Homebrew formula to `homebrew-oastools`
651+
652+ Monitor progress at :
653+ - Workflow : https://github.com/erraggy/oastools/actions
654+ - Release : https://github.com/erraggy/oastools/releases
655+ - Homebrew tap : https://github.com/erraggy/homebrew-oastools
656+
657+ 5. **Verify the release** :
658+ - Check that binaries were added to the GitHub Release
659+ - Verify Homebrew formula was updated in `homebrew-oastools`
660+ - Test Homebrew installation (optional) :
661+ ` ` ` bash
662+ brew tap erraggy/oastools
663+ brew install oastools
664+ oastools --version
665+ ` ` `
585666
586667**After Release:**
668+
587669- Verify the release appears correctly on GitHub
588- - The tag is automatically created by `gh release create`
589- - GitHub Actions will run (if configured) to build/publish artifacts
670+ - Test Homebrew installation : ` brew tap erraggy/oastools && brew install oastools`
671+ - Announce the release (if applicable)
672+ - Update project documentation if needed
673+
674+ **Troubleshooting:**
675+
676+ **Issue: GoReleaser can't push to homebrew-oastools**
677+ - Verify the `homebrew-oastools` repository exists and is public
678+ - Check that the GitHub token has `repo` scope
679+ - Ensure the commit author email in `.goreleaser.yaml` matches a verified email in your GitHub account
680+
681+ **Issue: Build fails for certain platforms**
682+ - Review the GitHub Actions logs for specific error messages
683+ - Check if any dependencies require CGO (we've set `CGO_ENABLED=0`)
684+ - Test locally with `make release-test` to reproduce the issue
685+
686+ **Issue: Homebrew formula doesn't work**
687+ - Verify the formula in `homebrew-oastools` repository
688+ - Test installation in a clean environment
689+ - Check binary architecture matches the user's system
590690
591691# # Go Module
592692
0 commit comments