Skip to content

Commit

Permalink
✨ auto changelog (#80)
Browse files Browse the repository at this point in the history
Here goes nothing 🤞. Please CI don't fail me.
  • Loading branch information
kkharji authored Aug 17, 2021
1 parent 47a11e3 commit 88f14bf
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{ 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 .Body }}
<dl><dd><details><summary><a href="{{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}"> {{ .Subject }}</a></summary>

{{ .Body }}
</details></dd></dl>
{{ else }}
- [{{ .Subject }}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }})
{{ end }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
41 changes: 41 additions & 0 deletions .github/chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/tami5/sql.nvim
options:
commits:
filters:
Type:
- sparkles
- bug
- zap
- recycle
- art
- package
- white_check_mark
- lock
- construction_worker
- boom
commit_groups:
title_maps:
sparkles: ":sparkles: Features"
boom: ":boom: Breaking Changes"
bug: ":bug: Bug Fixes"
zap: ":zap: Performance Improvements"
recycle: ":recycle: Code Refactoring"
art: ":art: structure/code formating"
memo: ":memo: Add or update documentation."
white_check_mark: ":white_check_mark: Add/Update Test Cases"
package: ":package: Dependencies"
lock: ":lock: Security"
construction_worker: ":construction_worker: CI Updates"
header:
pattern: "^:(\\w*)\\:\\s(.*)$"
pattern_maps:
- Type
- Subject
notes:
keywords:
- BREAKING CHANGE

46 changes: 46 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Generator Changelog
on:
push:
branches:
- master

jobs:
build-sources:
name: Generator Changelog
runs-on: ubuntu-20.04
container:
image: golang:1.16
steps:
- name: Check out a copy of the repo
uses: actions/checkout@v2
with: { fetch-depth: 0 }

- name: set todays-date
run: date +%F > todays-date

- name: Restore cache for today's nightly.
uses: actions/cache@v2
with:
path: build
key: ${{ runner.os }}-appimage-${{ hashFiles('todays-date') }}

- name: Prepare
run: go get github.com/git-chglog/git-chglog/cmd/git-chglog

- name: Generate Changelog
run: |
$(go env GOPATH)/bin/git-chglog --next-tag unreleased -c .github/chglog/config.yml -t .github/chglog/CHANGELOG.tpl.md -o CHANGELOG.md
- name: Update Changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MSG: |
:memo: update CHANGELOG.md
run: |
git config user.email "actions@github"
git config user.name "Actions"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git add CHANGELOG.md
# Only commit and push if we have changes
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})
3 changes: 1 addition & 2 deletions .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MSG: |
📝 DOC: Update doc/sql.txt
skip-checks: true
:memo: DOC: Update doc/sql.txt
run: |
git config user.email "actions@github"
git config user.name "Actions"
Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 88f14bf

Please sign in to comment.