Documentation
¶
Index ¶
- Constants
- Variables
- func CrossCompile(tmpDir string, cmds []string, targets []CrossTarget, repoDir string) ([]string, error)
- func GoreleaseAction(_ string) ghaction.Action
- func LatestReleaseTag() (string, error)
- func ParseReleaseArgs(args []string) (tag string, isHelp bool)
- func ReleaseWorkflow() ghaction.Workflow
- func TestWorkflow() ghaction.Workflow
- func VersionLdFlag(tag string) string
- type CrossTarget
- type GitClient
- type GitHubClient
- type Gorelease
- func (g *Gorelease) CrossCompileWithTag(tmpDir string, cmds []string, targets []CrossTarget, repoDir, tag string) ([]string, error)
- func (g *Gorelease) ReleaseOnly(tag string, gh GitHubClient) error
- func (g *Gorelease) SetConsoleOutput(fn func(string))
- func (g *Gorelease) SetCrossCompileFn(...)
- func (g *Gorelease) SetLog(fn func(...any))
- func (g *Gorelease) SetRootDir(path string)
Constants ¶
const ( ChecksumFile = "checksums.txt" DistDir = "dist" )
DRY constants — single source of truth for both Go and generated bash action.
const (
ActionFilePath = "action.yml"
)
Variables ¶
var Version = "v0.0.0"
Version is injected at build time via -ldflags="-X github.com/tinywasm/gorelease.Version=...". It is also used by `gorelease version` output.
Functions ¶
func CrossCompile ¶ added in v0.1.0
func CrossCompile(tmpDir string, cmds []string, targets []CrossTarget, repoDir string) ([]string, error)
CrossCompile builds the specified commands for multiple platforms.
func GoreleaseAction ¶ added in v0.1.0
GoreleaseAction builds the description of the gorelease action. It is a pure-bash composite action: no binary download, no extra weight. All cross-compile targets, ldflags and publish logic are derived from the DRY constants in gorelease.go (DefaultTargets, VersionLdFlag, etc.). Uses ghaction typed Action with presets for Node24 optimal defaults.
func LatestReleaseTag ¶ added in v0.1.0
LatestReleaseTag returns the highest semver tag in the repository.
func ParseReleaseArgs ¶ added in v0.1.0
ParseReleaseArgs parses gorelease CLI: gorelease [tag] Returns tag (may be empty) and isHelp.
func ReleaseWorkflow ¶ added in v0.1.1
ReleaseWorkflow returns the typed release workflow for gorelease self-release. It is pure Go, no hard-coded YAML strings — single source for action.yml + workflows. Uses ghaction presets for Node24 optimal defaults.
func TestWorkflow ¶ added in v0.1.1
TestWorkflow returns the typed test workflow (PR guard, read-only).
func VersionLdFlag ¶ added in v0.1.1
VersionLdFlag returns the -ldflags value for version injection.
Types ¶
type CrossTarget ¶ added in v0.1.0
type CrossTarget struct{ GOOS, GOARCH string }
CrossTarget represents a compilation target platform.
func DefaultTargets ¶ added in v0.1.0
func DefaultTargets() []CrossTarget
DefaultTargets returns the standard set of platforms for release.
type GitHubClient ¶ added in v0.1.0
type GitHubClient interface {
RepoInfo(repoRef string) (owner, name, visibility string, err error)
CreateRelease(tag string, assets []string, targetRepo string) (string, error)
}
GitHubClient is the minimal GitHub interface needed by ReleaseOnly.
type Gorelease ¶
type Gorelease struct {
// contains filtered or unexported fields
}
Gorelease orchestrates cross-compilation and GitHub Release creation.
func (*Gorelease) CrossCompileWithTag ¶ added in v0.1.0
func (g *Gorelease) CrossCompileWithTag(tmpDir string, cmds []string, targets []CrossTarget, repoDir, tag string) ([]string, error)
CrossCompileWithTag builds the specified commands for multiple platforms with version injection.
func (*Gorelease) ReleaseOnly ¶ added in v0.1.0
func (g *Gorelease) ReleaseOnly(tag string, gh GitHubClient) error
ReleaseOnly creates a GitHub Release with cross-platform binaries for an existing tag. If tag is empty, it uses the latest tag from git.GetLatestTag().
func (*Gorelease) SetConsoleOutput ¶ added in v0.1.0
SetConsoleOutput sets the function for console output.
func (*Gorelease) SetCrossCompileFn ¶ added in v0.1.0
func (g *Gorelease) SetCrossCompileFn(fn func(tmpDir string, cmds []string, targets []CrossTarget, repoDir string) ([]string, error))
SetCrossCompileFn sets a custom cross-compile function for testing.
func (*Gorelease) SetRootDir ¶ added in v0.1.0
SetRootDir sets the root directory for operations.