Skip to content

Commit

Permalink
devops: updated release process and changelog to git-chglog
Browse files Browse the repository at this point in the history
  • Loading branch information
clok committed Jul 19, 2020
1 parent d1f2daa commit 7ea760c
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 45 deletions.
56 changes: 56 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
35 changes: 35 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/GoodwayGroup/gwvault
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
bugfix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
chore: Chore
devops: DevOps
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.+)$"
pattern_maps:
- Type
- Scope
- Subject
merges:
pattern: "^(.*#\\d+.*)$"
pattern_maps:
- Source
notes:
keywords:
- BREAKING CHANGE
61 changes: 29 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
# Changelog
<a name="unreleased"></a>
## [Unreleased]

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<a name="1.3.0"></a>
## [1.3.0] - 2019-08-19
### Pull Requests
- Support check for TTY terminal when using `view` ([#7](https://github.com/GoodwayGroup/gwvault/issues/7))

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [1.3.0](https://github.com/GoodwayGroup/gwvault/compare/1.2.1...1.3.0) - 2019-08-19
<a name="1.2.1"></a>
## [1.2.1] - 2019-08-18
### Pull Requests
- Patch: Use `cat` instead of `more` ([#6](https://github.com/GoodwayGroup/gwvault/issues/6))
- Support rekey method ([#4](https://github.com/GoodwayGroup/gwvault/issues/4))
- Merge pull request [#3](https://github.com/GoodwayGroup/gwvault/issues/3) from GoodwayGroup/release/v1.2.0

### Merged

- Support check for TTY terminal when using `view` [`#7`](https://github.com/GoodwayGroup/gwvault/pull/7)
<a name="1.2.0"></a>
## [1.2.0] - 2018-10-30
### Pull Requests
- Support encrypt_string method ([#2](https://github.com/GoodwayGroup/gwvault/issues/2))

## [1.2.1](https://github.com/GoodwayGroup/gwvault/compare/1.0.1...1.2.1) - 2019-08-19

### Merged
<a name="1.1.0"></a>
## [1.1.0] - 2018-08-20
### Pull Requests
- Added support for file globs ([#1](https://github.com/GoodwayGroup/gwvault/issues/1))

- Patch: Use `cat` instead of `more` [`#6`](https://github.com/GoodwayGroup/gwvault/pull/6)
- Support rekey method [`#4`](https://github.com/GoodwayGroup/gwvault/pull/4)
- 1.2.0 [`#3`](https://github.com/GoodwayGroup/gwvault/pull/3)
- Support encrypt_string method [`#2`](https://github.com/GoodwayGroup/gwvault/pull/2)
- Added support for file globs [`#1`](https://github.com/GoodwayGroup/gwvault/pull/1)

### Commits

- fix create [`437786a`](https://github.com/GoodwayGroup/gwvault/commit/437786aaa4ebb2dcb083c57eaf2096bae32ee6b5)
- update makefile [`514d136`](https://github.com/GoodwayGroup/gwvault/commit/514d1361654dd4e91b8a042c6d458f3827ccf45c)

## [1.0.1](https://github.com/GoodwayGroup/gwvault/compare/1.0.0...1.0.1) - 2018-08-17

### Commits

- Added release script [`4f25e82`](https://github.com/GoodwayGroup/gwvault/commit/4f25e821c69d3fa42ec9be3ca703683eca006ea9)
- update README [`74949d5`](https://github.com/GoodwayGroup/gwvault/commit/74949d50517b88833511af5d8e87556f3e6c635f)
- fixed typo [`84df6c0`](https://github.com/GoodwayGroup/gwvault/commit/84df6c01a7cc75f4475b4f2d3d598020405c5c18)
<a name="1.0.1"></a>
## [1.0.1] - 2018-08-17

<a name="1.0.0"></a>
## 1.0.0 - 2018-08-17

### Commits

- build out of cli tool [`00750b9`](https://github.com/GoodwayGroup/gwvault/commit/00750b91d12c2cedbbcd326b09ef3fd21bbb9eae)
- Initial commit [`d1ff8dc`](https://github.com/GoodwayGroup/gwvault/commit/d1ff8dcff5bf4fa3a39f525945840c41e7692d05)
- updated release process [`59112ce`](https://github.com/GoodwayGroup/gwvault/commit/59112cef0a5ff78622ab6547a0ce64f3a12f0439)
[Unreleased]: https://github.com/GoodwayGroup/gwvault/compare/1.3.0...HEAD
[1.3.0]: https://github.com/GoodwayGroup/gwvault/compare/1.2.1...1.3.0
[1.2.1]: https://github.com/GoodwayGroup/gwvault/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/GoodwayGroup/gwvault/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/GoodwayGroup/gwvault/compare/1.0.1...1.1.0
[1.0.1]: https://github.com/GoodwayGroup/gwvault/compare/1.0.0...1.0.1
85 changes: 72 additions & 13 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,85 @@
#!/bin/bash -e
#!/bin/bash

set +e
set -o noglob

#
# Set Colors
#

bold="\e[1m"
dim="\e[2m"
underline="\e[4m"
blink="\e[5m"
reset="\e[0m"
red="\e[31m"
green="\e[32m"
blue="\e[34m"

#
# Common Output Styles
#

h1() {
printf "\n${bold}${underline}%s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
h2() {
printf "\n${bold}%s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
info() {
printf "${dim}➜ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
success() {
printf "${green}✔ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
error() {
printf "${red}${bold}✖ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
warnError() {
printf "${red}✖ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
warnNotice() {
printf "${blue}✖ %s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}
note() {
printf "\n${bold}${blue}Note:${reset} ${blue}%s${reset}\n" "$(echo "$@" | sed '/./,$!d')"
}

typeExists() {
if [ $(type -P $1) ]; then
return 0
fi
return 1
}

if ! typeExists "git-chglog"; then
error "git-chglog is not installed"
note "To install run: go get -u github.com/git-chglog/git-chglog/cmd/git-chglog"
exit 1
fi

VERSION=${1}

if [ "x${VERSION}x" = "xx" ]; then
echo "Must supply version number as first argument"
exit 1
error "Must supply version number as first argument"
exit 1
fi

echo "Updating CHANGELOG.md"
auto-changelog -v $VERSION -l false --template keepachangelog && git add CHANGELOG.md
git commit -m "$VERSION"
h1 "Preparing release of $VERSION"

echo "Tagging version: $VERSION"
h2 "Tagging version: $VERSION"
git tag $VERSION

echo "Building assets to be uploaded (currently manual process)"
h2 "Updating CHANGELOG.md"
git-chglog -o CHANGELOG.md && git add CHANGELOG.md
git commit -m "feat(release): $VERSION"

note "Building assets to be uploaded"
make ci

echo ""
echo "What you still need to do:"
echo "1. Push the tag: git push origin $VERSION"
echo "2. Update the release in github"
echo "3. Add the assets to the release."
note "What you still need to do:"
info "1. Push the tag: git push origin $VERSION"
info "2. Update the release in github with compiled assets."
echo ""
echo "Done!"
success "Done!"

0 comments on commit 7ea760c

Please sign in to comment.