From e4402f4a4af54bdbabd703d48dda19b012e2e575 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 28 Feb 2026 23:45:00 -0700 Subject: [PATCH] feat(monorel): push commits and tags before creating GitHub release Add Step 3 "git push && git push --tags" to the generated release script, between the tag creation step and the goreleaser build step. This fixes HTTP 422 "Release.target_commitish is invalid" errors from the GitHub API, which occur when the local commit (auto-created for a new .goreleaser.yaml) has not yet been pushed to the remote. --- tools/monorel/main.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/monorel/main.go b/tools/monorel/main.go index b5d1447..f93d7a6 100644 --- a/tools/monorel/main.go +++ b/tools/monorel/main.go @@ -1322,7 +1322,10 @@ func printModuleScript( line("# To undo: git tag -d %q", currentTag) } - section("Step 3: Build with goreleaser") + section("Step 3: Push commits and tags to remote") + line("git push && git push --tags") + + section("Step 4: Build with goreleaser") line("# release.disable=true in .goreleaser.yaml; goreleaser only builds.") if relPath == "." { line("goreleaser release --clean --skip=validate,announce") @@ -1333,10 +1336,10 @@ func printModuleScript( line(")") } - section("Step 4: Release notes") + section("Step 5: Release notes") line("%s=%s", notesVar, shellSingleQuote(releaseNotes)) - section("Step 5: Create draft GitHub release") + section("Step 6: Create draft GitHub release") tagVersion := currentTag[strings.LastIndex(currentTag, "/")+1:] title := projectName + " " + tagVersion line("gh release create %q \\", currentTag) @@ -1348,7 +1351,7 @@ func printModuleScript( line(" --draft \\") line(" --target %q", headSHA) - section("Step 6: Upload artifacts") + section("Step 7: Upload artifacts") line("gh release upload %q \\", currentTag) for _, bin := range bins { line(" %s/%s_*.tar.gz \\", distDir, bin.name) @@ -1357,7 +1360,7 @@ func printModuleScript( line(" \"%s/%s_%s_checksums.txt\" \\", distDir, projectName, version) line(" --clobber") - section("Step 7: Publish release (remove draft)") + section("Step 8: Publish release (remove draft)") line("gh release edit %q --draft=false", currentTag) blank()