release

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncrementVersion

func IncrementVersion(currentVersionStr, versionType string) (string, error)

IncrementVersion increments a version based on type

func NormalizeVersion

func NormalizeVersion(v string) (string, error)

NormalizeVersion ensures version has 'v' prefix and is valid semver

Types

type Action

type Action struct {
	Type        ActionType
	Target      string // tag name, module path
	Description string
	GitSHA      string // for existing tags
}

Action represents a planned release action

type ActionType

type ActionType int
const (
	ActionCreateTag ActionType = iota
	ActionPushTags
)

type Config

type Config struct {
	RepoRoot          string
	ExcludedDirs      []string
	RequiredBranch    string
	Verbose           bool
	Command           string // The subcommand being executed
	SkipConfirmations bool
	ManualVersion     string // Manual version override
}

Config holds the release configuration

type FS

type FS interface {
	FindGoModFiles(ctx context.Context, root string) ([]string, error)
}

FS defines filesystem operations for testing

type Git

type Git interface {
	GetCurrentBranch(ctx context.Context) (string, error)
	GetTags(ctx context.Context) ([]string, error)
	CreateTag(ctx context.Context, tag string) error
	PushTag(ctx context.Context, tag string) error
	GetRepoRoot(ctx context.Context) (string, error)
}

Git defines git operations for testing

type Manager

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

Manager handles the release process

func NewReleaseManager

func NewReleaseManager(config Config, git Git, fs FS, interaction UserInteraction) *Manager

func (*Manager) AssessCurrentState

func (rm *Manager) AssessCurrentState(ctx context.Context) (*State, error)

AssessCurrentState gathers repository state (assumes cache is already populated)

func (*Manager) CheckVersionExists

func (rm *Manager) CheckVersionExists(version string, modules []Module) (VersionConflictInfo, error)

func (*Manager) FindModules

func (rm *Manager) FindModules(ctx context.Context) ([]Module, error)

FindModules discovers all Go modules in the repository

func (*Manager) GetCurrentGlobalVersion

func (rm *Manager) GetCurrentGlobalVersion() string

func (*Manager) GetKnownReleases

func (rm *Manager) GetKnownReleases(ctx context.Context) error

GetKnownReleases fetches and parses all tags once

func (*Manager) GetNextPrereleaseVersion

func (rm *Manager) GetNextPrereleaseVersion(baseVersionStr string) (string, error)

func (*Manager) RunMajor

func (rm *Manager) RunMajor(ctx context.Context) error

func (*Manager) RunMinor

func (rm *Manager) RunMinor(ctx context.Context) error

func (*Manager) RunPatch

func (rm *Manager) RunPatch(ctx context.Context) error

func (*Manager) RunPrerelease

func (rm *Manager) RunPrerelease(ctx context.Context) error

func (*Manager) RunRelease

func (rm *Manager) RunRelease(ctx context.Context) error

func (*Manager) ShowCurrentState

func (rm *Manager) ShowCurrentState(ctx context.Context) error

ShowCurrentState displays current release state

func (*Manager) ShowPlannedActions

func (rm *Manager) ShowPlannedActions(actions []Action)

ShowPlannedActions displays what actions will be performed

type Module

type Module struct {
	Path    string
	Version string
}

Module represents a Go module

type ParsedTag

type ParsedTag struct {
	Raw           string          // Original tag name (e.g., "service1/v1.2.3-prerelease01")
	ModulePath    string          // Module path (e.g., "service1", "" for root)
	Version       *semver.Version // Parsed semantic version
	GitSHA        string          // Git commit SHA
	IsPrerelease  bool
	PrereleaseNum int // Extracted prerelease number (01, 02, etc.)
}

ParsedTag represents a single parsed git tag

type State

type State struct {
	CurrentBranch  string
	Modules        []Module
	CurrentVersion string
	TagCache       *TagCache
}

State holds the current state of the repository

type TagCache

type TagCache struct {
	AllTags         []ParsedTag
	VersionTags     []ParsedTag            // Only valid semver tags
	ModuleTags      map[string][]ParsedTag // Tags grouped by module path
	PrereleaseCache map[string][]int       // Base version -> prerelease numbers
	HighestVersion  *semver.Version        // Cached highest version
}

TagCache holds all parsed tag information

type UserInteraction

type UserInteraction interface {
	Confirm(ctx context.Context, message string) (bool, error)
	ConfirmWithDefault(ctx context.Context, message string, defaultValue bool) (bool, error)
}

UserInteraction defines the interface for user interactions

type VersionConflictInfo

type VersionConflictInfo struct {
	ExistingTags []string // Tags that already exist
	MissingTags  []string // Tags that need to be created
}

VersionConflictInfo holds information about version conflicts

type Warning

type Warning struct {
	Type    WarningType
	Message string
}

Warning represents a validation warning that can be overridden

type WarningType

type WarningType int

WarningType represents different types of warnings

const (
	WrongBranch WarningType = iota
	ExistingTags
)

Jump to

Keyboard shortcuts

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