Documentation
¶
Index ¶
- type TagInfo
- type Tagger
- func (t *Tagger) CalculateNextVersion(ctx context.Context, scheme version.Scheme, bump version.BumpType, ...) (*version.Version, error)
- func (t *Tagger) CommitVersionUpdate(ctx context.Context, filePath, version string) error
- func (t *Tagger) CreateNextTag(ctx context.Context, scheme version.Scheme, bump version.BumpType, ...) (string, error)
- func (t *Tagger) CreateTag(ctx context.Context, tag, message string) error
- func (t *Tagger) CurrentCommit(ctx context.Context) (string, error)
- func (t *Tagger) GetTagInfo(ctx context.Context, tagName string) (*TagInfo, error)
- func (t *Tagger) GetVersionWithDirtyCheck(ctx context.Context) (string, error)
- func (t *Tagger) HasUncommittedChanges(ctx context.Context) (bool, error)
- func (t *Tagger) IsTagOnCurrentCommit(ctx context.Context, tag string) (bool, error)
- func (t *Tagger) LatestTag(ctx context.Context) (string, error)
- func (t *Tagger) ListAllTags(ctx context.Context) ([]TagInfo, error)
- func (t *Tagger) ParseLatestVersion(ctx context.Context, scheme version.Scheme) (*version.Version, error)
- func (t *Tagger) PushTag(ctx context.Context, tag string) error
- func (t *Tagger) ShortCommit(ctx context.Context) (string, error)
- func (t *Tagger) TagExists(ctx context.Context, tag string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tagger ¶
type Tagger struct {
// contains filtered or unexported fields
}
Tagger handles git tag operations.
func (*Tagger) CalculateNextVersion ¶
func (t *Tagger) CalculateNextVersion(ctx context.Context, scheme version.Scheme, bump version.BumpType, calverFormat, pre, meta string) (*version.Version, error)
CalculateNextVersion calculates the next version without creating a tag. This is useful when you need to know the version before making changes (e.g., updating package.json).
func (*Tagger) CommitVersionUpdate ¶
CommitVersionUpdate commits a version file update (like package.json). It stages the file, creates a commit with a standard message.
func (*Tagger) CreateNextTag ¶
func (t *Tagger) CreateNextTag(ctx context.Context, scheme version.Scheme, bump version.BumpType, calverFormat, pre, meta string) (string, error)
CreateNextTag generates the next tag based on the scheme and creates it. For semver, bump is required. For calver, the current date is used.
func (*Tagger) CreateTag ¶
CreateTag creates an annotated tag with the given name and message. If dryRun is true, only logs the operation without creating the tag.
func (*Tagger) CurrentCommit ¶
CurrentCommit returns the current commit hash.
func (*Tagger) GetTagInfo ¶
GetTagInfo retrieves detailed information for a specific tag. It handles prefix auto-detection by trying both the exact tag name and with the configured prefix. Returns TagInfo with all fields populated, or an error if the tag doesn't exist.
func (*Tagger) GetVersionWithDirtyCheck ¶
GetVersionWithDirtyCheck returns the version string, appending "-dirty-<short-commit>" if there are uncommitted changes or if the latest tag is not on the current commit. If no tags exist, it returns "0.0.0-dev".
func (*Tagger) HasUncommittedChanges ¶
HasUncommittedChanges checks if there are uncommitted changes in the repository.
func (*Tagger) IsTagOnCurrentCommit ¶
IsTagOnCurrentCommit checks if the given tag points to the current commit.
func (*Tagger) LatestTag ¶
LatestTag returns the latest tag with the configured prefix, or empty string if none exists.
func (*Tagger) ListAllTags ¶
ListAllTags returns all tags with the configured prefix, sorted by version (newest first). For each tag, it includes the commit hash, date, and message.
func (*Tagger) ParseLatestVersion ¶
func (t *Tagger) ParseLatestVersion(ctx context.Context, scheme version.Scheme) (*version.Version, error)
ParseLatestVersion returns the parsed version of the latest tag, or nil if no tag exists.
func (*Tagger) PushTag ¶
PushTag pushes the tag to the remote repository. If dryRun is true, only logs the operation without pushing.
func (*Tagger) ShortCommit ¶
ShortCommit returns the short commit hash (first 7 characters).