Create GitHub Release with cross-platform binaries for an existing tag.
gorelease is a release-only tool: it does not create tags or commits. It cross-compiles
a Go project's cmd/ binaries for multiple platforms and uploads them as assets to a
GitHub Release.
go install github.com/tinywasm/devflow/cmd/gorelease@latestgorelease [tag]- tag: An optional explicit version tag (e.g.,
v1.2.3). If not provided, it is read fromgit.GetLatestTag()(the highest semver tag in the repository).
-
Validation: Verifies that the repository has a
cmd/directory with at least one subdirectory. -
Tag Resolution: If no tag is provided, reads the latest tag from git.
-
Cross-Compilation: Compiles all commands found in
cmd/for the following platforms:- Linux (amd64, arm64)
- macOS (arm64, amd64)
- Windows (amd64)
It injects the version into
main.Versionand uses optimization flags (-s -w -trimpath). -
Checksums: Generates a
checksums.txtfile (SHA256) for all compiled binaries and includes it as a release asset. -
Target Resolution: Automatically decides where to publish the release:
- If
originis PUBLIC, it publishes toorigin(classic behavior). - If
originis PRIVATE, it derives a public repository name:<owner>/<folder-name>. If that repository exists and is public, it publishes there using the--repoflag. This allows maintaining private source code while distributing public binaries.
- If
-
GitHub Release: Creates a GitHub Release using the
ghCLI, with the tag name as the title, and uploads the cross-compiled binaries and checksums as release assets. -
Cleanup: Automatically removes the temporary directory used for compilation.
The default compilation targets are:
| OS | Architecture | Artifact Name |
|---|---|---|
| linux | amd64 | <cmd>-linux-amd64 |
| linux | arm64 | <cmd>-linux-arm64 |
| darwin | arm64 | <cmd>-darwin-arm64 |
| darwin | amd64 | <cmd>-darwin-amd64 |
| windows | amd64 | <cmd>-windows-amd64.exe |
goinstalled and in PATH.gh(GitHub CLI) installed, authenticated, and in PATH.- A standard Go project structure with a
go.modfile and acmd/directory. - An existing tag in the git repository (created by
gopushorcodejob).
# Release the latest tag (highest semver)
gorelease
# Release an explicit tag
gorelease v1.2.3The -release flag in codejob automatically triggers a release after gopush:
# Publish module + create GitHub Release in one step
codejob 'feat: new feature' -release
# With explicit tag
codejob 'feat: new feature' v1.2.3 -release- gopush - Publish Go modules and create tags.
- codejob - Orchestrate coding tasks with optional release.
- Flow Diagram - Visual representation of the
goreleaseprocess.