releaseit

module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT

README

ReleaseIt! Go go report card PkgGoDev codecov

Utility for generating and publishing changelogs to different destinations.

Inspired by mikepenz/release-changelog-builder-action

All application options

Click to expand
Application Options:
      --dbg                                    turn on debug mode [$DEBUG]

Help Options:
  -h, --help                                   Show this help message

[changelog command options]
          --from=                              sha to start release notes from
                                               [$FROM]
          --to=                                sha to end release notes to [$TO]

[release command options]
          --tag=                               tag to be released [$TAG]

[common options]
    engine:
          --engine.type=[github|gitlab]        type of the repository engine
                                               [$ENGINE_TYPE]

    repo:
          --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_USERN-

                                               AME]
          --engine.github.basic_auth.password= password for basic auth
                                               [$ENGINE_GITHUB_BASIC_AUTH_PASSW-

                                               ORD]

    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]

    notify:
          --notify.stdout                      print release notes to stdout
                                               [$NOTIFY_STDOUT]
          --notify.conf_location=              location to the config file
                                               [$NOTIFY_CONF_LOCATION]

    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_PREVI-

                                               EW]

    github:
          --notify.github.release_name_tmpl=   template for release name
                                               [$NOTIFY_GITHUB_RELEASE_NAME_TMP-

                                               L]

    repo:
          --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_USERN-

                                               AME]
          --notify.github.basic_auth.password= password for basic auth
                                               [$NOTIFY_GITHUB_BASIC_AUTH_PASSW-

                                               ORD]

    mattermost:
          --notify.mattermost.base_url=        base url of the mattermost
                                               server
                                               [$NOTIFY_MATTERMOST_BASE_URL]
          --notify.mattermost.channel_id=      id of the channel, where the
                                               release notes will be sent
                                               [$NOTIFY_MATTERMOST_CHANNEL_ID]
          --notify.mattermost.login_id=        login id of the user, who will
                                               send the release notes
                                               [$NOTIFY_MATTERMOST_LOGIN_ID]
          --notify.mattermost.password=        password of the user, who will
                                               send the release notes
                                               [$NOTIFY_MATTERMOST_PASSWORD]
          --notify.mattermost.ldap             use ldap auth
                                               [$NOTIFY_MATTERMOST_LDAP]

Note: from and to options of changelog command accept expressions, which must be written in gotemplate manner, and the whole expressions should start from !! prefix.

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

Supported functions:

  • last_commit(branch_name)
  • head

Release notes builder configuration

Name Description
categories Categories of pull requests
categories.title Title, which will be provided to the release notes template
categories.labels An 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.branch A regular expression to match branch name to the corresponding category.
ignore_labels An 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
sort_field Field, by which pull requests must be sorted, in format +|-field currently supported fields: number, author, title, closed
template Template for a changelog in golang's text template language
empty_template Template for release with no changes
unused_title If set, the unused category will be built under this title at the end of the changelog

Example release notes builder configuration

categories:
  - title: "## 🚀 Features"
    branch: "^(feat|feature)/"
    labels:
      - "feature"
  - title: "## 🐛 Fixes"
    branch: "^fix/"
    labels:
      - "fix"
  - title: "## 🧰 Maintenance"
    branch: "^chore/"
    labels:
      - "maintenance"
unused_title: "## ❓ Unlabeled"
ignore_labels:
  - "ignore"
sort_field: "-number"
template: |
  Project: Example release config
  Development area: Backend
  Version {{.Version}}
  Date: {{.Date.Format "Jan 02, 2006 15:04:05 UTC"}}
  {{if not .Categories}}- No changes{{end}}{{range .Categories}}{{.Title}} | {{ len .PRs }}
  {{range .PRs}}- [!{{.Number}}]({{.URL}}) {{.Title}} | by @{{.Author}}, closed at {{.ClosedAt.Format "02.01.2006 15:04:05 MST"}}
  {{end}}{{end}}
empty_template: "- no changes"

Template variables for release notes builder

Name Description Example
{{.Version}} Version name of the release, might be tag or diff. v1.0.0 or 2bda1d3...82e35cf
{{.Date}} Date of the commit which was tagged Jan 02, 2006 15:04:05 UTC
{{.Categories.Title}} Title of the category from the config Features
{{.Categories.PRs.Number}} Number of the pull request 642
{{.Categories.PRs.Title}} Title of the pull request Some awesome feature added
{{.Categories.PRs.Author}} Username of the author of pull request Semior001
{{.Categories.PRs.ClosedAt}} Timestamp, when the pull request was closed (might be empty) Jan 02, 2006 15:04:05 UTC
{{.Categories.PRs.URL}} URL to the pull request https://github.com/Semior001/releaseit/pull/6

The golang's text/template package is used for executing template for release notes.

(Github) Template variables for release title

Name Description Example
{{.TagName}} Tag name of the release v1.0.0

Directories

Path Synopsis
app
Package main is an entrypoint for application
Package main is an entrypoint for application
cmd
Package cmd defines commands of the application.
Package cmd defines commands of the application.
cmd/flg
Package flg defines flags, common for all commands.
Package flg defines flags, common for all commands.
config
Package config contains the definition of the configuration file.
Package config contains the definition of the configuration file.
git
Package git contains types and engines to work with git repositories.
Package git contains types and engines to work with git repositories.
git/engine
Package engine contains interfaces for different git providers.
Package engine contains interfaces for different git providers.
notify
Package notify defines interfaces each supported notification destination should implement.
Package notify defines interfaces each supported notification destination should implement.
service
Package service wraps engine interfaces with common logic unrelated to any particular engine implementation.
Package service wraps engine interfaces with common logic unrelated to any particular engine implementation.

Jump to

Keyboard shortcuts

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