Milestoner
Milestoner is a pure Git based Command Line Interface (CLI) for software deployment automation that is agnostic of the programming language or source control service you use (i.e. GitHub, GitLab, Bitbucket, etc). Each milestone (i.e. Git tag) includes the automatic generation of feature rich release notes sourced from the Git commits that make up the tag. Finally, each milestone adheres to Strict Semantic Versioning so your milestones remain consistent.
You can use Milestoner to inspect the current state of the next milestone, celebrate the team members that contribute to each milestone, and share information with stakeholders with minimal effort. By having a tool, like Milestoner, you can automate software releases in a consistent and reliable fashion. π
Milestoner pairs well with the following gems:
- Screenshots
- ASCII Doc
- Feed
- Markdown Format
- Stream
- Web
- Features
- Requirements
- Setup
- Usage
- Command Line Interface (CLI)
- Customization
- Config
- Cache
- Build
- Commits
- Sanitization
- Trailers
- Automatic Versioning
- Templates
- Formats
- Security
- Development
- Tests
- License
- Security
- Code of Conduct
- Contributions
- Developer Certificate of Origin
- Versions
- Community
- Credits
Screenshots
Features
-
Uses Versionaire for Strict Semantic Versioning. Example:
-
Format:
<major>.<minor>.<patch>
. -
Example:
0.0.0
.
-
-
Defaults to including Git commits since last tag (or initialization of repository) when building release notes. This can be customized further if desired.
-
Ensures Git commit messages are grouped by prefix, in order defined, for categorization. For more details, see Git Lint Commit Subject Prefix. Defaults (can be customized):
-
Ensures Git commit messages are alphabetically sorted for release note categorization and readability.
-
Provides automatic versioning based on last Git tag and Git Trailers. See Git Commit Anatomy for details.
-
Supports multiple build formats:
-
Syndication (feed)
-
Stream (console)
-
Web (HTML)
-
Supports Git Notes.
-
Supports customization via your personal XDG, Runcom, and/or Hanami Views configuration.
Setup
To install with security, run:
# π‘ Skip this line if you already have the public certificate installed.
gem cert --add <(curl --compressed --location https://alchemists.io/gems.pem)
gem install milestoner --trust-policy HighSecurity
To install without security, run:
gem install milestoner
Usage
Customization
This gem can be configured via a global configuration:
~/.config/milestoner/configuration.yml
It can also be configured via XDG environment variables.
The default configuration is:
avatar:
uri: "https://avatars.githubusercontent.com/u/%<id>s"
build:
basename: "index"
format: "stream"
layout: "page"
max: 1
root: "tmp/milestones"
stylesheet: "page"
tail: "head"
commit:
categories:
- emoji: "β
"
label: "Fixed"
- emoji: "π’"
label: "Added"
- emoji: "πΌ"
label: "Updated"
- emoji: "βοΈ"
label: "Removed"
- emoji: "π"
label: "Refactored"
format: "asciidoc"
uri: "https://github.com/%<project_owner>s/%<project_name>s/commit/%<id>s"
organization:
label: "Undefined"
uri: "https://undefined.io"
profile:
uri: "https://github.com/%<id>s"
project:
owner: "undefined"
uri:
home: "%<organization_uri>s/projects/%<project_name>s"
version: "%<project_uri_home>s/versions/%<id>s"
review:
uri: "https://github.com/%<project_owner>s/%<project_name>s/pulls/%<id>s"
syndication:
categories:
- label: "Milestones"
name: "milestones"
entry:
label: "%<id>s"
uri: "%<project_uri_version>s"
id: "%<project_uri_version>s"
label: "%<organization_label>s: %<project_label>s"
links:
- label: "%<organization_label>s: %<project_label>s (web)"
mime: "text/html"
relation: "alternate"
uri: "%<project_uri_home>s/versions"
- label: "%<organization_label>s: %<project_label>s (feed)"
mime: "application/atom+xml"
relation: "self"
uri: "%<project_uri_home>s/versions.xml"
tracker:
uri: "https://github.com/%<project_owner>s/%<project_name>s/issues/%<id>s"
The above can be customized as follows:
-
avatar
: Manages team member avatar details.-
uri
: Required. The URI format for linking to avatars as formatted using String Formats. Default: GitHub. Theid
is dynamically calculated via theexternal_id
of the user stored in the Lode cache.
-
-
build
: Manages build details.-
basename
: Required. The build file basename. Default:index
. Used to customize the built file name. -
format
: Required. The build output format. Default:stream
. Used to determine what format to build the release notes as. Multiple formats are supported. -
layout
: Required. The Hanami Views layout used when building release notes. Default: page. This can be disabled when usingfalse
or customized furtherβββvia your own XDG configurationβββwhen providing your own templates and/or partials. -
max
: Required. The maximum number of Git tags to build. Default: 1. By default, you are limited to building release notes for changes (commits) since the last tag but you can increase the maximum to build release notes for as many tags as you like. -
root
: Required. The the root build directory. Default:tmp/milestones
. This can be a relative or absolute path and defaults your current project. The path is automatically created if missing. -
stylesheet
: Required. The stylesheet basename which is only used by the web format. Default:page
. This can be a relative path (i.e.../page
) which is especially handy when buildmax
is set to a number greater than one so the release notes for each tag you build loads the stylesheet properly. The path is automatically created if missing.
-
-
commit
: Manages commit categories, emojis, hyperlinks, and formatting.-
categories
: Required. Defaults to five categories which pairs well with the Git Lint gem. Category order is important with the first taking precedence over the second and so forth. Special characters are allowed for prefixes but should be enclosed in quotes. To disable categories, use an empty array. Example:categories: []
.-
emoji
: Required. The emoji associated with the label for output purposes. Used by the ASCII Doc, Markdown, and stream build formats. Defaults to the provided emojis. -
label
: Required. Allows you to customize the category label. All commits are grouped by label which equates to the prefix, or first word, used in each commit message. The defaults pair well with the Git Lint gem. Defaults to the provided labels.
-
-
format
: Required. Defines the default format used for rendering commit messages unless specified in the commit trailer metadata which takes higher precedence. Default:asciidoc
. -
uri
: Required. The URI for linking to commits as formatted using String Formats. Default: GitHub. Theid
is dynamically calculated via the commit SHA of each commit analyzed at runtime.
-
-
generator
: Manages generator details.-
label
: Required. The label of the generator used for all software milestones. Default: Milestoner. -
uri
: Required. The URI of the generator used for all software milestones. Defaults to Milestonerβs homepage URL as provided by the Gem Specification of this project. -
version
: Required. The version of the generator used for all software milestones. Defaults to Milestonerβs current version as provided by the Gem Specification of this project.
-
-
loaded_at
: Required. Dynamically calculated when the configuration is loaded and is generally meant to represent current time. You can customize this value but is not recommended. -
organization
: Manages organization details.-
label
: Required. The organizationβs label. Can be used within other keys via String Formats and is meant for branding purposes. -
uri
: Required. The organizationβs home page URI. Can be used within other keys via String Formats.
-
-
profile
: Manages team member profile details.-
uri
: Required. The URI format for linking to profiles as formatted using String Formats. Default: GitHub. Theid
is dynamically calculated via thehandle
of the user stored in the Lode cache.
-
-
project
: Manages project details.-
author
: Required. The project author. Dynamically calculated by the Etcher gem in the following order: This value or Git configuration user name. -
description
: Optional. The project description. Dynamically calculated by the Etcher gem in the following order: This value, Gem Specification summary, or CFF abstract. -
label
: Optional. The project label. Dynamically calculated by the Etcher gem in the following order: This value, Gem Specification metadata label, or CFF title. -
name
: Required. The project name. Dynamically calculated by the Etcher gem in the following order: This value or Gem Specification name. -
owner
: Required. The project owner. This is your source code organization or user handle. Used when formatting URLs (mentioned above). Default:undefined
. It is strongly recommended you configure this value so all links are formatted properly. -
uri
: Manages project URI details.-
home
: Required. The project home URI. Dynamically calculated by the Etcher gem in the following order: This value, Gem Specification homepage, or CFF URL. -
icon
: Optional. The project icon URI. Used for branding. For example, you could use an organization specific URI:"%<organization_uri>s/images/projects/%<project_name>s/favicon.ico"
. -
logo
: Optional. The project logo URI. Used for branding. For example, you could use an organization specific URI:"%<organization_uri>s/images/projects/%<project_name>s/logo.png"
. -
version
: Required. The project version URI. Defaults to the versions folder of your project home URI. This ensures all release notes link back to your project.
-
-
version
: Required. The project version. Dynamically calculated based on the last Git tag of your project and GitMilestone
commit trailer metadata. The default is:0.0.0
. For more on this see, the Automatic Versioning section below. You can configure a value but is not recommended since any custom value you supply will be used for all deployments and release notes. Youβre better off letting this gem compute this for you.
-
-
review
: Manages code review details.-
uri
: Required. The URI format for linking to code reviews as formatted using String Formats. Default: GitHub. Theid
is currently a placeholder for future feature support when API support is added. For now this links to all code reviews with the goal to link to individual code reviews based on Git Trailers.
-
-
syndication
: Manages syndicated feed details when used with thefeed
build format.-
categories
: Required. Manages category details.-
label
: Required. The category label. Default: Milestones. -
name
: Required. The category name. Default: milestone.
-
-
entry
: Required. Manages feed entry details which are the details of each Git tag.-
label
: Required. The entry label. Default:%<id>s
. Automatically calculated, at runtime, for the current version. -
uri
: Required. The entry URI. The full URI to your project version. The default uses your project version URI. If customized, ensure you include%<id>s
so the URI can properly link to the calculated version at runtime.
-
-
id
: The ID of your feed which, per Atom specification, should be the the URI of your project (including version) which is why this defaults to your project version URI. If customized, ensure the%<id>s
is included for proper runtime calculation. -
label
: The label of your feed and is what people will see when subscribing to your feed. Defaults to dynamic string formatting based on existing configuration values. -
links
: Required. Provides links to HTML and XML versions of your feed. This can be an array of links but generally you only need HTML and XML formats.-
label
: Required. The link label. Defaults to dynamic string formatting based on existing configuration values. -
mime
: Required. The mime type. Defaults to HTML and XML. -
relation
: Required. Identifies the relation of the link which can either beself
(i.e. XML) oralternate
(i.e. HTML). -
uri
: Required. The link URI to follow for more information. Defaults to dynamic string formatting based on existing configuration values.
-
-
-
tracker
: Required. Manages issue tracker details.-
uri
: Required. The URI format for linking to issues as formatted using String Formats. Default: GitHub. Theid
is dynamically calculated via the commitIssue
trailer as linted by Git Lint. When no ID can be found, this will default to All issues.
-
As hinted at above, all URIs (including syndication), support String Formats. This means you can use the %<key>s
formatβββreplacing key
with the key of your choiceβββto customize your configuration further.
π‘ If you need to know what your current configuration looks like, you can jump into your applications IRB console and inspect Milestoner::Container[:settings]
to see full details.
Config
Milestoner can be configured via the command line using: milestoner config
. This allows you to create, edit, view, and/or delete your global or local configuration as desired. The configuration is managed by the Runcom gem which is built atop the XDG gem for managing global or local configurations. Please read the documentation of each gem to learn more.
Cache
Milestonerβs cache allows you to enrich user information (i.e. authors, collaborators, etc) by storing information in a PStore
database as managed by the Lode gem. Cache location, as with the Config, is managed by the Runcom gem.
User information should be sourced from whatever service used for managing your source code. For example, when using GitHub, your workflow might look like this:
milestoner cache --list
# π’ [milestoner] Listing users...
# π’ [milestoner] No users found.
milestoner cache --create "111,jsmith,Jane Smith"
# π’ [milestoner] Created: "Jane Smith"
milestoner cache --create "222,jdoe,John Doe"
# π’ [milestoner] Created: "John Doe"
milestoner cache --create "333,jgrey,Jill Grey"
# π’ [milestoner] Created: "Jill Grey"
milestoner cache --list
# π’ [milestoner] Listing users...
# External ID, Handle, Name
# -------------------------
# "111", "jsmith", "Jane Smith"
# "222", "jdoe", "John Doe"
# "333", "jgrey", "Jill Grey"
milestoner cache --delete "Jill Grey"
# π’ [milestoner] Deleted: "Jill Grey".
milestoner cache --list
# π’ [milestoner] Listing users...
# External ID, Handle, Name
# -------------------------
# "111", "jsmith", "Jane Smith"
# "222", "jdoe", "John Doe"
milestoner cache --info
# π’ [milestoner] Path: /Users/bkuhlmann/.cache/milestoner/database.store.
π‘ Use https://api.github.com/users/<handle>
to acquire the external ID for any GitHub user.
Once team member information is stored in your cache, youβll be able to build release notes which automatically link to GitHub user information without constantly hitting the GitHub API. Users are identified by name so the full author name used for each commit message needs to match the same user name as stored in your source repository hosting service.
If you donβt use the cache, your release notes use a question mark (?) and unknown for team members as highlighted below:
Build
The build command allows you to quickly build release notes to check the current status of your project or deploy a new milestone. By default, the build command uses either the default or custom configuration as documented in the Configuration section above. This means, when using the defaults, you can immediately build the release notes for your project in a temporary directory:
milestoner build --format web
# π’ [milestoner] Building Milestoner (web)...
# π’ [milestoner] Built: /Users/bkuhlmann/Engineering/OSS/milestoner/tmp/milestones/page.css.
# π’ [milestoner] Built: /Users/bkuhlmann/Engineering/OSS/milestoner/tmp/milestones/index.html.
The above command is so useful that I use the following msw
(i.e. Milestoner Web) Bash alias to build current release notes or release notes for several tags:
# Label: Milestoner (web)
# Description: Build milestone(s) in web format.
# Parameters: $1 (optional): Maximum tags to build. Default: 1.
msw() {
local max=${1:-1}
local root="tmp/milestones"
local path="$root/index.html"
rm -rf tmp/milestones
if [[ "$max" == 1 ]]; then
milestoner build --max "$max" --format web
if [[ -f "$path" ]]; then
open "$path"
fi
else
milestoner build --max "$max" --stylesheet "../page" --format web
if [[ -d "$root" ]]; then
ruby -run -e httpd "tmp/milestones" --port 3030 &
open "http://localhost:3030"
fg
fi
fi
}
Check out the help documentation (i.e. milestoner build --help
) for addition usage that explains what command line options you can use to overwrite the current configuration.
Commits
ASCII Doc is rendered using the Asciidoctor gem while Markdown is rendered using the Redcarpet gem. Regardless of what renderer you choose, each supports syntax highlighting via the Rouge gem. This also means you can customize the Rouge styles via the page.css
template as documented in the Templates section below.
βΉοΈ The Rouge CSS classes are slightly cryptic in terms of readability but you can see how they are applied when inspecting the HTML DOM.
ASCII Doc
Markdown
π‘ To see an example of what this renders to HTML as, see the Formats section below.
Sanitization
Sanitization of commit messages is handled by the Sanitize gem. This means you can only use a limited set of HTML elements (this includes ASCII Doc and Markdown rendering). Hereβs whatβs allowed:
The following global attributes are allowed for all elements:
The following attributes are limited to only a few elements like a
, abbr
, and dfn
for the most part.
An additional set of attributes are allowed but are specific to each element and fairly limited. Ultimately, if you donβt see an attribute being rendered then itβs not allowed.
Trailers
Multiple Git Trailers for your commits are supported which are detailed in the linked article. At a minimum, the Milestone
trailer is highly recommended since this is how Milestoner handles Automatic Versioning for you.
One of the more powerful features of using Git Trailers in your commit messages is they give you the ability to fully resolve what is defined in your default global configuration. Hereβs a more detailed breakdown:
-
Format (optional): Use
ascii_doc
ormarkdown
for the value to control what syntax used to render your commit message. The default isascii_doc
but if your configuration uses a different default you can override that per commit message if desired. -
Issue (optional): When supplied, Milestoner will automatically associate your commit with the corresponding issue ID you provide as a value. This works in conjunction with your configuration.
-
Milestone (optional): This is detailed in the Automatic Versioning section below.
Automatic Versioning
As mentioned earlier, the calculation of version information happens automatically based on your last Git tag and any Git commit trailer metadata used. If none of this information is present, then the default version of 0.0.0
is used instead. All of this information is available to you via the following command:
milestoner build --help
Running the above will dynamically show you latest version informationβββalong with help documentationβββin case you have doubts. You can use this as a status check as well. If you donβt want to use the automatic version, you can override by using the --version
option when building. Example:
# Uses automatic version.
milestoner build --format stream
# Uses manual version.
milestoner build --format stream --version 1.2.3
By default, automatic versioning is based on your last known Git tag. The version is bumped based on Git commit trailer information from untagged commits (i.e. commits created since the last tag). All of this is managed via the Versionaire gem. To ensure automatic versioning works properly, you only need to add the Milestone
Git commit trailer with a value of: patch
, minor
, or major
. Hereβs an example assuming you have published Version 1.0.0:
# First commit. Milestone: patch # Second commit. Milestone: minor # Third commit Milestone: patch
Given the above, the resulting version would be: 1.1.0. This is because the highest milestone was a minor milestone. The highest milestone wins and doesnβt matter how many commits you made with the same milestone trailer information or the order in which the commits were made. Hereβs another example:
# First commit. Milestone: patch # Second commit. Milestone: patch # Third commit Milestone: patch
Given the above, the resulting version would be: 1.0.1. This is because the highest milestone was a patch. Hereβs a final example:
# First commit. Milestone: major # Second commit. Milestone: minor # Third commit Milestone: patch
Given the above, the resulting version would be: 2.0.0. This is because the highest milestone was a major milestone.
Templates
Template functionality is powered by Hanami Views which means you can completely customize all build formats, templates, partials, stylesheets, images, and much more.
The quickest way to start customization is to copy the templates
folder structureβββincluded with this gemβββto your preferred Runcom configuration (i.e. global or local). For example, this gemβs template structure is:
lib/milestoner/templates βββ layouts β βββ page.adoc.erb β βββ page.html.erb β βββ page.md.erb β βββ page.stream.erb β βββ page.xml.erb βββ milestones β βββ _avatar.adoc.erb β βββ _avatar.html.erb β βββ _avatar.md.erb β βββ _avatar.xml.erb β βββ _commit.adoc.erb β βββ _commit.html.erb β βββ _commit.md.erb β βββ _commit.stream.erb β βββ _commit.xml.erb β βββ _content.adoc.erb β βββ _content.html.erb β βββ _content.xml.erb β βββ _logo.adoc.erb β βββ _logo.html.erb β βββ _logo.md.erb β βββ _logo.xml.erb β βββ _none.adoc.erb β βββ _none.html.erb β βββ _none.xml.erb β βββ _profile.adoc.erb β βββ _profile.html.erb β βββ _profile.md.erb β βββ _profile.xml.erb β βββ _tag-insecure.html.erb β βββ _tag-secure.html.erb β βββ _tag.adoc.erb β βββ _tag.html.erb β βββ _tag.md.erb β βββ _tag.stream.erb β βββ _tag.xml.erb β βββ _user.adoc.erb β βββ _user.html.erb β βββ _user.md.erb β βββ _user.xml.erb β βββ _users.adoc.erb β βββ _users.html.erb β βββ _users.xml.erb β βββ show.adoc.erb β βββ show.html.erb β βββ show.md.erb β βββ show.stream.erb β βββ show.xml.erb βββ public βββ page.css.erb
This means you could, for example, copy all of Milestonerβs default templates to your own Runcom configuration and customize as you see fit. Example (using global configuration):
cp -r <milestoner_gem_root>/lib/milestoner/templates $HOME/.config/milestoner/templates
Milestoner searches your Runcom configuration first and, if templates are detected, will be used instead. Otherwise, Milestoner falls back to itβs own templates. Once Runcom has calculated all possible template locations, Hanami Views handles the final loading and rendering of the templates.
Formats
Of all build formats supported, the web format is the most powerful and feature rich. The following showcases some of the information rendered in this format based on commit activity.
Overview
With Valid Commit Signature
With Invalid Commit Signature
With Valid Tag
With Invalid Tag
With ASCII Doc/Markdown
π‘ See Git Notes to learn more.
Youβll find all formats render similar information with the feed format being the closest but most formats are not as feature rich as the web format. Each milestone is meant to provide you with the right amount of statistical information you can make informed decisions.
Security
brew install gpg
gpg --gen-key
When creating your GPG key, choose these settings:
-
Key kind: RSA and RSA (default)
-
Key size: 4096
-
Key validity: 0
-
Real Name:
<your name>
-
Email:
<your email>
-
Passphrase:
<your passphrase>
To obtain your key, run the following and take the part after the forward slash:
gpg --list-keys | grep pub
Add your key to your global (or local) Git configuration and ensure GPG signing for your tag is enabled. Example:
[tag] gpgSign = true [user] signingkey = <your GPG key>
Development
To contribute, run:
git clone https://github.com/bkuhlmann/milestoner
cd milestoner
bin/setup
You can also use the IRB console for direct access to all objects:
bin/console
Tests
To test, run:
bundle exec spec
Credits
-
Built with Gemsmith.
-
Engineered by Brooke Kuhlmann.