Documentation
¶
Index ¶
- func Calculate(finder ModuleFinder, tags git.ModuleTags, config repotools.Config, ...) (map[string]*Module, error)
- func CalculateDependencyUpdates(modules map[string]*Module) error
- func CalculateNextVersion(modulePath string, latest string, config repotools.ModuleConfig, ...) (next string, err error)
- func NextReleaseID(tags []string) (next string)
- type Annotations
- type Manifest
- type Module
- type ModuleChange
- type ModuleFinder
- type ModuleManifest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Calculate ¶
func Calculate(finder ModuleFinder, tags git.ModuleTags, config repotools.Config, annotations []changelog.Annotation) (map[string]*Module, error)
Calculate calculates the modules to be released and their next versions based on the Git history, previous tags, module configuration, and associated changelog annotations.
func CalculateDependencyUpdates ¶
CalculateDependencyUpdates determines which modules require a dependency update bump due to one or more of its direct or indirect dependencies being bumped. This will set the DependencyUpdate bit flag on the modules set of changes.
func CalculateNextVersion ¶
func CalculateNextVersion(modulePath string, latest string, config repotools.ModuleConfig, annotations []changelog.Annotation, preReleaseIdentifier string) (next string, err error)
CalculateNextVersion calculates the next version for the module. The provided set of annotations must be applicable for this specific module.
func NextReleaseID ¶
NextReleaseID returns the next release identifier based on current YYYY-MM-DD and whether there are multiple tags for the given date. For example:
First Release => YYYY-MM-DD Second Same-Day Release => YYYY-MM-DD.2
Types ¶
type Annotations ¶
type Annotations []string
Annotations is a type alias for changelog.Annotation to control how annotations are marshaled in a release manifest.
type Manifest ¶
type Manifest struct { ID string `json:"id"` WithReleaseTag bool `json:"with_release_tag"` Modules map[string]ModuleManifest `json:"modules"` Tags []string `json:"tags"` }
Manifest is a release description of changed modules and their associated tags to be released.
func BuildReleaseManifest ¶
func BuildReleaseManifest(moduleTree *gomod.ModuleTree, id string, modules map[string]*Module, verbose bool, preRelease string) (rm Manifest, err error)
BuildReleaseManifest given a mapping of Go module paths to their Module descriptions, returns a summarized manifest for release.
type Module ¶
type Module struct { // The parsed go.mod file File *modfile.File // The modules relative path from the repository root RelativeRepoPath string // The most recent semver tagged release Latest string // The next semver tag to release Next string // The changes for the module Changes ModuleChange FileChanges []string // The change note identifiers applicable for this module ChangeAnnotations []changelog.Annotation // The release configuration for this module ModuleConfig repotools.ModuleConfig }
Module is a description of a repository Go module and knowledge about it's current release state.
func FindModuleViaRelativeRepoPath ¶
FindModuleViaRelativeRepoPath Searches through the map of calculated module changes, for a module with the relative repository path specified. If a module is found it will be returned.
type ModuleChange ¶
type ModuleChange uint64
ModuleChange is a bit field to describe the changes for a module
const ( // SourceChange indicates that the module has source changes since the last tagged release SourceChange ModuleChange = 1 << (64 - 1 - iota) // NewModule indicates that the module is new and has not been tagged previously NewModule // DependencyUpdate indicates the module has changes due to a dependency bump DependencyUpdate )
func (ModuleChange) MarshalJSON ¶
func (m ModuleChange) MarshalJSON() ([]byte, error)
MarshalJSON marshals the chnage bits into a structure JSON object.
func (ModuleChange) String ¶
func (m ModuleChange) String() string
String returns the ModuleChange as a list of the change kinds.
func (*ModuleChange) UnmarshalJSON ¶
func (m *ModuleChange) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the JSON object bytes into the ModuleChange bit-field representation.
type ModuleFinder ¶
type ModuleFinder interface { // Absolute Path of the root directory all modules are nested within. Root() string // Returns a tree of the known modules. Modules() *gomod.ModuleTree }
ModuleFinder is a type that searches for modules
type ModuleManifest ¶
type ModuleManifest struct { ModulePath string `json:"module_path"` From string `json:"from,omitempty"` To string `json:"to"` Changes ModuleChange `json:"changes,omitempty"` FileChanges []string `json:"file_changes,omitempty"` Annotations Annotations `json:"annotations,omitempty"` }
ModuleManifest describes a changed module for release.