Skip to content

Commit

Permalink
feat(ci): Automatically generate changelog from commit messages
Browse files Browse the repository at this point in the history
Commit messages since the previous release have been rewritten to
match the current changelog generator template
  • Loading branch information
wdullaer committed Jan 18, 2020
1 parent c19c915 commit 278d69f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .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 .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
28 changes: 28 additions & 0 deletions .github/chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/wdullaer/scotty
options:
commits:
filters:
Type:
- feat
- fix
- docs
- refactor
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
refactor: Code Refactoring
docs: Documentation
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
11 changes: 11 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ jobs:
- name: Generate checksums
run: for file in scotty-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done

- name: Install go (needed for changelog tool)
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Generate changelog
run: |
export PATH=${PATH}:$(go env GOPATH)/bin
go get -u github.com/git-chglog/git-chglog/cmd/git-chglog
git-chglog -c .github/chglog/config.yml $(git describe --tags) > CHANGELOG.md
- name: Create GitHub release ${{ matrix.target }}
uses: softprops/action-gh-release@v1
with:
Expand All @@ -218,5 +228,6 @@ jobs:
scotty-x86_64-apple-darwin.tar.gz.sha256
scotty-x86_64-pc-windows-msvc.zip
scotty-x86_64-pc-windows-msvc.zip.sha256
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 278d69f

Please sign in to comment.