release

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangelogInfo

func ChangelogInfo(summer Summarizer, config ChangelogInfoConfig) (*Release, *Description, error)

ChangelogInfo identifies the last release (the start of the changelog) and returns a description of the current (potentially speculative) release.

Types

type ChangelogInfoConfig

type ChangelogInfoConfig struct {
	VersionSpeculator
	RepoPath         string
	SinceTag         string
	UntilTag         string
	ChangeTypeTitles []change.TypeTitle
}

type Description

type Description struct {
	Release                             // the release being described
	VCSReferenceURL  string             // the URL to find more information about this release, e.g. https://github.com/nextlinux/chronicle/releases/tag/v0.4.1
	VCSChangesURL    string             // the URL to find the specific source changes that makeup this release, e.g. https://github.com/nextlinux/chronicle/compare/v0.3.0...v0.4.1
	Notice           string             // manual note or summary that describes the changelog at a high level
	Changes          change.Changes     // all issues and PRs that makeup this release
	SupportedChanges []change.TypeTitle // the sections of the changelog and their display titles
}

Description contains all the data and metadata about a release that is pertinent to a changelog.

type MockSummarizer

type MockSummarizer struct {
	MockLastRelease string
	MockRelease     string
	MockChanges     []change.Change
	MockRefURL      string
	MockChangesURL  string
}

func (MockSummarizer) Changes

func (m MockSummarizer) Changes(_, _ string) ([]change.Change, error)

func (MockSummarizer) ChangesURL

func (m MockSummarizer) ChangesURL(_, _ string) string

func (MockSummarizer) LastRelease

func (m MockSummarizer) LastRelease() (*Release, error)

func (MockSummarizer) ReferenceURL

func (m MockSummarizer) ReferenceURL(_ string) string

func (MockSummarizer) Release

func (m MockSummarizer) Release(_ string) (*Release, error)

type MockVersionSpeculator

type MockVersionSpeculator struct {
	MockNextIdealVersion  string
	MockNextUniqueVersion string
}

func (MockVersionSpeculator) NextIdealVersion

func (m MockVersionSpeculator) NextIdealVersion(_ string, _ change.Changes) (string, error)

func (MockVersionSpeculator) NextUniqueVersion

func (m MockVersionSpeculator) NextUniqueVersion(_ string, _ change.Changes) (string, error)

type Release

type Release struct {
	Version string
	Date    time.Time
}

Release represents a version of software at a point in time.

type SpeculationBehavior

type SpeculationBehavior struct {
	EnforceV0           bool // if true, and the version is currently < v1.0 breaking changes do NOT bump the major semver field; instead the minor version is bumped.
	NoChangesBumpsPatch bool // if true, and no changes make up the current release, still bump the patch semver field.
}

SpeculationBehavior contains configuration that controls how to determine the next release version.

type Summarizer

type Summarizer interface {
	// LastRelease returns the last posted release (chronologically) from a source (e.g. a GitHub Release entry via the API). If no release can be found then nil is returned (without an error).
	LastRelease() (*Release, error)

	// Release returns the specific release for the given ref (e.g. a tag or commit that has a GitHub Release entry via the API). If no release can be found then nil is returned (without an error)
	Release(ref string) (*Release, error)

	// Changes returns all changes between the two given references (e.g. tag or commits). If `untilRef` is not provided then the latest VCS change found will be used.
	Changes(sinceRef, untilRef string) ([]change.Change, error)

	// ReferenceURL is the URL to find more information about this release, e.g. https://github.com/nextlinux/chronicle/releases/tag/v0.4.1 .
	ReferenceURL(tag string) string

	// ChangesURL is the URL to find the specific source changes that makeup this release, e.g. https://github.com/nextlinux/chronicle/compare/v0.3.0...v0.4.1 .
	ChangesURL(sinceRef, untilRef string) string
}

Summarizer is an abstraction for summarizing release information from a source (e.g. GitBub, GitLab, local repo tags, etc).

type VersionSpeculator

type VersionSpeculator interface {
	// NextIdealVersion reports the next version based on the currentVersion and a set of changes
	NextIdealVersion(currentVersion string, changes change.Changes) (string, error)

	// NextUniqueVersion is the same as NextIdealVersion, however, it additionally considers if the final speculated version is already released. If so, then the next non-released patch version (relative to the ideal version) is returned.
	NextUniqueVersion(currentVersion string, changes change.Changes) (string, error)
}

VersionSpeculator is something that is capable of surmising the next release based on the set of changes from the last release.

Directories

Path Synopsis
releasers

Jump to

Keyboard shortcuts

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