Skip to content

Repository files navigation

ReleaseIt! Gogo report cardPkgGoDevcodecov

Utility for generating and publishing changelogs to different destinations.

Inspired by mikepenz/release-changelog-builder-action

Installation

ReleaseIt is distributed as a docker image. You can pull it from ghcr package.

Env vars configuration example is available here.

How it works.

It looks for the closed pull requests attached to merge or squash commits between the references provided in arguments, and splits them into categories, which are defined in the configuration file.

A commit with two or more parents is considered a merge commit. Squash commits are matched by the regexp provided in arguments (default is ^.*#\d+.*$ - any commit message with # and a number in it).

To avoid repeats of pull requests among the releases (e.g., in case a developer resolved conflicts by merging the main branch into the feature branch, so the merge commit will be repeated in the commit history); it checks that the merge/squash commit is after the commit provided within the FROM argument.

All application options

Click to expand
Application Options:
--dbg turn on debug mode [$DEBUG]
Help Options:
-h, --help Show this help message
[preview command options]
--data-file= path to the file with release data [$DATA_FILE]
--extras= extra variables to use in the template, will be merged (env primary) with ones in the config file [$EXTRAS]
--conf-location= location to the config file [$CONF_LOCATION]
[changelog command options]
--from= commit ref to start release notes from (default: {{ previousTag .To (headed (filter semver tags)) }}) [$FROM]
--to= commit ref to end release notes to (default: {{ last (filter semver tags) }}) [$TO]
--timeout= timeout for assembling the release (default: 5m) [$TIMEOUT]
--fetch-merge-commits-filter= regexp to filter merge commits (default: .*) [$FETCH_MERGE_COMMITS_FILTER]
--conf-location= location to the config file [$CONF_LOCATION]
--extras= extra variables to use in the template [$EXTRAS]
--max-concurrent-pr-requests= maximum number of concurrent PR requests (default: 10) [$MAX_CONCURRENT_PR_REQUESTS]
--commits-only only include commits, do not try to fetch PRs [$COMMITS_ONLY]
engine:
--engine.type=[github|gitlab] type of the repository engine [$ENGINE_TYPE]
github:
--engine.github.timeout= timeout for http requests (default: 5s) [$ENGINE_GITHUB_TIMEOUT]
repo:
--engine.github.repo.full-name= full name of the repository (owner/name) [$ENGINE_GITHUB_REPO_FULL_NAME]
--engine.github.repo.owner= owner of the repository [$ENGINE_GITHUB_REPO_OWNER]
--engine.github.repo.name= name of the repository [$ENGINE_GITHUB_REPO_NAME]
basic-auth:
--engine.github.basic-auth.username= username for basic auth [$ENGINE_GITHUB_BASIC_AUTH_USERNAME]
--engine.github.basic-auth.password= password for basic auth [$ENGINE_GITHUB_BASIC_AUTH_PASSWORD]
gitlab:
--engine.gitlab.token= token to connect to the gitlab repository [$ENGINE_GITLAB_TOKEN]
--engine.gitlab.base-url= base url of the gitlab instance [$ENGINE_GITLAB_BASE_URL]
--engine.gitlab.project-id= project id of the repository [$ENGINE_GITLAB_PROJECT_ID]
--engine.gitlab.timeout= timeout for http requests (default: 5s) [$ENGINE_GITLAB_TIMEOUT]
notify:
--notify.stdout print release notes to stdout [$NOTIFY_STDOUT]
--notify.stderr print release notes to stderr [$NOTIFY_STDERR]
telegram:
--notify.telegram.chat-id= id of the chat, where the release notes will be sent [$NOTIFY_TELEGRAM_CHAT_ID]
--notify.telegram.token= bot token [$NOTIFY_TELEGRAM_TOKEN]
--notify.telegram.web-page-preview request telegram to preview for web links [$NOTIFY_TELEGRAM_WEB_PAGE_PREVIEW]
--notify.telegram.timeout= timeout for http requests (default: 5s) [$NOTIFY_TELEGRAM_TIMEOUT]
github:
--notify.github.timeout= timeout for http requests (default: 5s) [$NOTIFY_GITHUB_TIMEOUT]
--notify.github.release-name-tmpl= template for release name [$NOTIFY_GITHUB_RELEASE_NAME_TMPL]
--notify.github.tag= tag to specify release [$NOTIFY_GITHUB_TAG]
--notify.github.extra= extra parameters to pass to the notifier [$NOTIFY_GITHUB_EXTRA]
repo:
--notify.github.repo.full-name= full name of the repository (owner/name) [$NOTIFY_GITHUB_REPO_FULL_NAME]
--notify.github.repo.owner= owner of the repository [$NOTIFY_GITHUB_REPO_OWNER]
--notify.github.repo.name= name of the repository [$NOTIFY_GITHUB_REPO_NAME]
basic-auth:
--notify.github.basic-auth.username= username for basic auth [$NOTIFY_GITHUB_BASIC_AUTH_USERNAME]
--notify.github.basic-auth.password= password for basic auth [$NOTIFY_GITHUB_BASIC_AUTH_PASSWORD]
mattermost-hook:
--notify.mattermost-hook.url= url of the mattermost hook, can take multiple values, delim envs with ',' [$NOTIFY_MATTERMOST_HOOK_URL]
--notify.mattermost-hook.timeout= timeout for http requests (default: 5s) [$NOTIFY_MATTERMOST_HOOK_TIMEOUT]
mattermost-bot:
--notify.mattermost-bot.base-url= base url for mattermost API [$NOTIFY_MATTERMOST_BOT_BASE_URL]
--notify.mattermost-bot.token= token of the mattermost bot [$NOTIFY_MATTERMOST_BOT_TOKEN]
--notify.mattermost-bot.channel-id= channel id of the mattermost bot [$NOTIFY_MATTERMOST_BOT_CHANNEL_ID]
--notify.mattermost-bot.timeout= timeout for http requests (default: 5s) [$NOTIFY_MATTERMOST_BOT_TIMEOUT]
post:
--notify.post.url= url to send the release notes [$NOTIFY_POST_URL]
--notify.post.timeout= timeout for http requests (default: 5s) [$NOTIFY_POST_TIMEOUT]
task:
--task.type=[|jira] type of the task tracker [$TASK_TYPE]
jira:
--task.jira.base-url= url of the jira instance [$TASK_JIRA_BASE_URL]
--task.jira.token= token to connect to the jira instance [$TASK_JIRA_TOKEN]
--task.jira.timeout= timeout for http requests (default: 5s) [$TASK_JIRA_TIMEOUT]
enricher:
--task.jira.enricher.load-watchers load watchers for the issue [$TASK_JIRA_ENRICHER_LOAD_WATCHERS]

Note: from and to options of changelog command accept expressions, which must be written in gotemplate manner. from expression can relate on the value of to, to is evaluated first.

Example (from .env file): TO='{{ last_commit "develop" }}'

Preview data file structure

Click to expand
FieldDescription
fromCommit ref to start release notes from
toCommit ref to end release notes at
extrasExtra variables to use in the template
pull_requests.numberPull request number
pull_requests.titlePull request title
pull_requests.bodyPull request body
pull_requests.author.usernamePull request's author's username
pull_requests.author.emailPull request's author's email
pull_requests.labelsList of pull request's labels
pull_requests.closed_atDate of the pull request's closing
pull_requests.source_branchPull request's source branch
pull_requests.target_branchPull request's target branch
pull_requests.urlPull request's url
pull_requests.received_by_shasList of commit SHAs by which pull request was retrieved (for debugging purposes)
pull_requests.assignees.usernameAssignee's username
pull_requests.assignees.emailAssignee's email
tasks.idTask ID
tasks.parent_idTask's parent ID
tasks.urlTask's URL
tasks.nameTask's name
tasks.bodyTask's body
tasks.closed_atTask's closing date
tasks.author.usernameTask's author's username
tasks.author.emailTask's author's email
tasks.assignee.usernameTask's assignee's username
tasks.assignee.emailTask's assignee's email
tasks.typeTask's type
tasks.type_rawTask's raw type
tasks.flaggedTask's flagged status
tasks.watchers.usernameList of task's watchers
tasks.watchers.emailList of task's watchers' emails
tasks.watches_countCount of task's watchers
commits.shaCommit SHA
commits.parent_shasList of commit's parent SHAs
commits.messageCommit message
commits.committed_atCommit's commit date
commits.authored_atCommit's authored date
commits.urlCommit's URL
commits.author.usernameCommit's author's username
commits.author.emailCommit's author's email
commits.committer.usernameCommit's committer's username
commits.committer.emailCommit's committer's email

See example for details.

Evaluator functions

The list of available to use functions consists of sprig's functions list, and a several custom functions, including:

Click to expand
Function nameDescription
next(elem string, elems []string) stringreturns next element in the list
previous(elem string, elems []string) stringreturns previous element in the list
filter(rx string, elems []string) []stringfilters list of strings by regular expression
stringsFromAnys([]interface{}) []stringcasts list of any to list of strings
Constants
semver() stringreturns semver regular expression (^v?(\d+)\.(\d+)\.(\d+)$)
Addons
git
prTitles(prs []git.PullRequest) []stringreturns the list of titles of provided pull requests
headed(vals []string) []stringadds "HEAD" to the head of the list
lastCommit(branch string) (string, error)returns the SHA of the last commit of the branch
tags() ([]string, error)returns the list of all tags in repository
previousTag(commitAlias string, tags []string) (string, error)returns the previous (closest) tag of the provided commit in the provided list of tags
task
getTicket(id string) (task.Ticket, error)returns ticket by its ID
listTickets(ids []string, loadParents bool) ([]task.Ticket, error)lists tickets by their IDs, with parents attached, if loadParents is set to true
release-notes
buildTicketsTree(tickets []task.Ticket) (roots []*TicketNode, err error)builds tree out of provided tickets
loadTicketsTree(ticketIDRx string, loadParents bool, prs []git.PullRequest, commits []git.Commit) (LoadedTree, error)loads tickets tree from the provided pull requests, ticket IDs are matched from pull request titles by the provided regexp
listTaskUsers(obj any, args ...string) (string, error)lists users from the provided task ticket, any in first argument to match embedded structs
listPRs(prs []git.PullRequest, mode ...string) (string, error)returns a comma-separated list of markdown-formatted links to PRs, example: [Title1](URL1), [Title2](URL2). Has different modes, "title" makes the list of PR titles, "number" makes the list of PR numbers in style "!". Default is "title"
listCommits(commits []git.Commit) stringreturns a comma-separated list of markdown-formatted links to commits, example: [short-SHA1](URL1), [short-SHA2](URL2)
mdTaskLink(obj any) (string, error)returns markdown-formatted link to the task ticket, example: [Title](URL)
brackets(s string, square ...bool) stringreturns string wrapped in brackets, if square is set to true, square brackets will be used. If the string is empty, it returns an empty string
log(msg string, args ...interface{}) stringlogs the debug message with provided arguments to stderr. Always returns an empty string
  • from and to flags may use git addon functions.
  • release notes builder template may use all functions above.

Types

Click to expand
// LoadedTree is a tree of tickets with their children and PRs.typeLoadedTreestruct {
Roots []*TicketNodeUnattached []git.PullRequest
}
// TicketNode is a representation of a ticket with its children.typeTicketNodestruct {
task.TicketChildren []*TicketNodePRs []git.PullRequest
}
// PullRequest represents a pull/merge request from the// remote repository.typePullRequeststruct {
Numberint`yaml:"number"`Titlestring`yaml:"title"`Bodystring`yaml:"body"`AuthorUser`yaml:"author"`Labels []string`yaml:"labels"`ClosedAt time.Time`yaml:"closed_at"`SourceBranchstring`yaml:"source_branch"`TargetBranchstring`yaml:"target_branch"`URLstring`yaml:"url"`ReceivedBySHAs []string`yaml:"received_by_shas"`Assignees []User`yaml:"assignees"`
}
// User holds user data.typeUserstruct {
Usernamestring`yaml:"username"`Emailstring`yaml:"email"`
}
// Commit represents a repository commit.typeCommitstruct {
SHAstringParentSHAs []stringMessagestringCommittedAt time.TimeAuthoredAt time.Time
}
// CommitsComparison is the result of comparing two commits.typeCommitsComparisonstruct {
Commits []CommitTotalCommitsint
}
// Tag represents a repository tag.typeTagstruct {
NamestringCommitCommit
}
// Type specifies the type of the task.typeTypestringconst (
// TypeEpic is an epic task type.TypeEpicType="epic"// TypeTask is a simple task type.TypeTaskType="task"// TypeSubtask is a sub-task type.TypeSubtaskType="subtask"
)
// Ticket represents a single task in task tracker.typeTicketstruct {
IDstringParentIDstringURLstringNamestringBodystringClosedAt time.TimeAuthorUserAssigneeUserTypeTypeTypeRawstring// save raw type in case if user wants to distinguish different raw valuesFlaggedbool
}
// User represents a task tracker user.typeUserstruct {
UsernamestringEmailstring
}
// LoadedTree is a tree of tickets with their children and PRs.typeLoadedTreestruct {
Roots []*TicketNodeUnattached []git.PullRequest
}
// TicketNode is a representation of a ticket with its children.typeTicketNodestruct {
task.TicketChildren []*TicketNodePRs []git.PullRequest
}

Release notes builder configuration

NameDescription
categoriesCategories of pull requests
categories.titleTitle, which will be provided to the release notes template
categories.labelsAn array of labels, to match pull request labels against. If any PR label matches any category label, the pull request will show up under this category
categories.branchA regular expression to match source branch name to the corresponding category.
categories.commit_messageA regular expression to match commit message to the corresponding category.
sort_fieldField, by which pull requests must be sorted, in format +|-field currently supported fields: number, author, title, closed
templateTemplate for a changelog in golang's text template language
unused_titleIf set, the unused category will be built under this title at the end of the changelog
ignore_labelsAn array of labels, to match pull request labels against. If PR contains any of the defined ignore labels - this PR won't be provided to the template
ignore_branchA regular expression to match pull request branches, that won't appear in the changelog

See example for details.

Template variables for release notes builder

NOTE: commits will be provided in categories only in case if it wasn't matched to any pull request.

NameDescriptionExample
{{.From}}From commit SHA / tagv0.1.0
{{.To}}To commit SHA / tagv0.2.0
{{.Date}}Date, when the changelog was builtJan 02, 2006 15:04:05 UTC
{{.Extras}}Map of extra variables, provided by the user in envsmap[foo:bar]
{{.Total}}Total number of pull requests10
{{.Categories.Title}}Title of the category from the configFeatures
{{.Categories.PRs.Number}}Number of the pull request642
{{.Categories.PRs.Title}}Title of the pull requestSome awesome feature added
{{.Categories.PRs.Author}}Username of the author of pull requestSemior001
{{.Categories.PRs.URL}}URL to the pull requesthttps://github.com/Semior001/releaseit/pull/6
{{.Categories.PRs.SourceBranch}}Source branch name, from which the pull request was createdfeature/awesome-feature
{{.Categories.PRs.TargetBranch}}Target branch name, to which the pull request was createddevelop
{{.Categories.PRs.ClosedAt}}Timestamp, when the pull request was closed (might be empty)Jan 02, 2006 15:04:05 UTC
{{.Categories.PRs.ReceivedBySHAs}}List of commit SHAs, by which releaseit received pull requests[a1b2c3d4e5f6, 1a2b3c4d5e6f]
{{.Categories.PRs.Assignees}}List of assignees of the pull request[Semior001, Semior002]
{{.Categories.Commits.SHA}}SHA of the commita1b2c3d4e5f6
{{.Categories.Commits.ParentSHAs}}List of parent commit SHAs[a1b2c3d4e5f6, 1a2b3c4d5e6f]
{{.Categories.Commits.Message}}Message of the commitsome feature merged
{{.Categories.Commits.CommittedAt}}Timestamp, when the commit was committedJan 02, 2006 15:04:05 UTC
{{.Categories.Commits.AuthoredAt}}Timestamp, when the commit was authoredJan 02, 2006 15:04:05 UTC
{{.Categories.Commits.URL}}URL to the commit`
{{.Categories.Commits.Author}}Username of the author of the commitSemior001
{{.Categories.Commits.Committer}}Username of the committer of the commitSemior001

For functions available to use see the list of evaluator functions.

(Github) Template variables for release title

NameDescriptionExample
{{.Tag.Name}}Tag namev1.0.0
{{.Tag.Message}}Tag messageVersion v1.0.0
{{.Tag.Author}}Tag authorSemior001
{{.Tag.Date}}Tag dateJan 02, 2006 15:04
{{.Commit.SHA}}Commit SHAa1b2c3d4e5f6
{{.Commit.Message}}Commit messagesome feature merged
{{.Commit.Author.Name}}Commit author nameSemior001
{{.Commit.Author.Date}}Date, when commit was authoredJan 02, 2006 15:04
{{.Commit.Committer.Name}}Commit committer nameSemior001
{{.Commit.Committer.Date}}Date, when commit was committedJan 02, 2006 15:04
{{.Extras}}Map of extra variablesmap[foo:bar]

For functions available to use see the list of evaluator functions.

About

Tool for generating release notes by extracting information from remote resources

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages