parser

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package parser provides functions to parse a Git repository commit history.

This package is used to compute the semantic version number from a formatted Git repository commit history. To do so, it expects the commit history to follow the Conventional Commits specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchLatestSemverTag

func FetchLatestSemverTag(repository *git.Repository) (*object.Tag, error)

FetchLatestSemverTag parses a Git repository to fetch the tag corresponding to the highest semantic version number among all tags.

Types

type ComputeNewSemverOutput

type ComputeNewSemverOutput struct {
	Semver     *semver.Semver
	CommitHash plumbing.Hash
	NewRelease bool
}

type OptionFunc

type OptionFunc func(*Parser)

func WithBuildMetadata

func WithBuildMetadata(metadata string) OptionFunc

func WithPrereleaseIdentifier

func WithPrereleaseIdentifier(s string) OptionFunc

func WithPrereleaseMode

func WithPrereleaseMode(b bool) OptionFunc

func WithReleaseBranch

func WithReleaseBranch(branch string) OptionFunc

type Parser

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

func New

func New(logger zerolog.Logger, tagger *tag.Tagger, rules rule.Rules, options ...OptionFunc) *Parser

func (*Parser) ComputeNewSemver

func (p *Parser) ComputeNewSemver(repository *git.Repository) (ComputeNewSemverOutput, error)

ComputeNewSemver returns the next, if any, semantic version number from a given Git repository by parsing its commit history.

func (*Parser) ParseHistory

func (p *Parser) ParseHistory(commits []*object.Commit, latestSemver *semver.Semver) (bool, plumbing.Hash, error)

ParseHistory parses a slice of commits and modifies the given semantic version number according to the release rule provided.

Jump to

Keyboard shortcuts

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