releaser

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindLatestVersion

func FindLatestVersion(tags []string) string

FindLatestVersion finds the highest semver version from a list of tags.

func IsSemver

func IsSemver(s string) bool

IsSemver checks if a string is a valid semver tag.

func NextMajorVersion

func NextMajorVersion(current string) (string, error)

NextMajorVersion returns the next major version from the current version string.

func NextMinorVersion

func NextMinorVersion(current string) (string, error)

NextMinorVersion returns the next minor version from the current version string.

func NextPatchVersion

func NextPatchVersion(current string) (string, error)

NextPatchVersion returns the next patch version from the current version string.

Types

type GitHubReleaser

type GitHubReleaser struct {
	// contains filtered or unexported fields
}

GitHubReleaser implements Releaser for GitHub.

func NewGitHubReleaser

func NewGitHubReleaser(token string) *GitHubReleaser

NewGitHubReleaser creates a new GitHub releaser.

func (*GitHubReleaser) CreateRelease

func (r *GitHubReleaser) CreateRelease(ctx context.Context, req *model.ReleaseRequest) (*model.Release, error)

CreateRelease creates a new release for a repository.

func (*GitHubReleaser) CreateTag

func (r *GitHubReleaser) CreateTag(ctx context.Context, repo model.RepoRef, tagName, sha, message string) error

CreateTag creates a new tag for a repository.

func (*GitHubReleaser) GetDefaultBranchSHA

func (r *GitHubReleaser) GetDefaultBranchSHA(ctx context.Context, repo model.RepoRef, branch string) (string, error)

GetDefaultBranchSHA returns the SHA of the default branch HEAD.

func (*GitHubReleaser) GetLatestTag

func (r *GitHubReleaser) GetLatestTag(ctx context.Context, repo model.RepoRef) (string, error)

GetLatestTag returns the most recent semver tag.

func (*GitHubReleaser) GetTagSHA

func (r *GitHubReleaser) GetTagSHA(ctx context.Context, repo model.RepoRef, tagName string) (string, error)

GetTagSHA returns the SHA for a given tag.

type Options

type Options struct {
	Prefix        string // Version prefix, e.g., "v"
	GenerateNotes bool   // Use GitHub's auto-generated release notes
	Draft         bool   // Create as draft
	Prerelease    bool   // Mark as prerelease
	IncludeBody   bool   // Include changelog in body
}

Options configures release behavior.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns sensible default release options.

type Releaser

type Releaser interface {
	// CreateRelease creates a new release for a repository.
	CreateRelease(ctx context.Context, req *model.ReleaseRequest) (*model.Release, error)

	// CreateTag creates a new tag for a repository.
	CreateTag(ctx context.Context, repo model.RepoRef, tagName, sha, message string) error

	// GetLatestTag returns the most recent semver tag.
	GetLatestTag(ctx context.Context, repo model.RepoRef) (string, error)

	// GetTagSHA returns the SHA for a given tag.
	GetTagSHA(ctx context.Context, repo model.RepoRef, tagName string) (string, error)

	// GetDefaultBranchSHA returns the SHA of the default branch HEAD.
	GetDefaultBranchSHA(ctx context.Context, repo model.RepoRef, branch string) (string, error)
}

Releaser defines the interface for creating releases.

func NewGitHub

func NewGitHub(token string) Releaser

NewGitHub creates a new GitHub releaser with the given token.

type Version

type Version struct {
	Major      int
	Minor      int
	Patch      int
	Prerelease string
	Build      string
	Prefix     string // "v" or empty
}

Version represents a semantic version.

func Parse

func Parse(v string) (*Version, error)

Parse parses a version string into a Version struct.

func (*Version) BumpMajor

func (v *Version) BumpMajor() *Version

BumpMajor increments the major version and resets minor and patch.

func (*Version) BumpMinor

func (v *Version) BumpMinor() *Version

BumpMinor increments the minor version and resets patch.

func (*Version) BumpPatch

func (v *Version) BumpPatch() *Version

BumpPatch increments the patch version.

func (*Version) Compare

func (v *Version) Compare(other *Version) int

Compare compares two versions. Returns -1 if v < other, 0 if v == other, 1 if v > other.

func (*Version) String

func (v *Version) String() string

String returns the version as a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL