Skip to content

Commit

Permalink
Add Actions pipeline for changelog (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockopp authored and Neal committed Dec 13, 2019
1 parent 8d734fb commit 96e59f3
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ 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 .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/go-vela/types
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
# title_maps:
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# name of the action
name: release

# trigger on push events with `v*` in tag
on:
push:
tags:
- 'v*'

# pipeline to execute
jobs:
release:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:
- name: clone
uses: actions/checkout@v1

- name: tags
run: |
git fetch --tags
- name: version
id: version
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: install
run: |
go get github.com/git-chglog/git-chglog/cmd/git-chglog
go get github.com/itchio/gothub
- name: changelog
run: |
# https://github.com/git-chglog/git-chglog#git-chglog
$(go env GOPATH)/bin/git-chglog \
-o $GITHUB_WORKSPACE/CHANGELOG.md \
${{ steps.version.outputs.VERSION }}
- name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# https://github.com/itchio/gothub#gothub
$(go env GOPATH)/bin/gothub edit \
--user go-vela \
--repo types \
--tag ${{ steps.version.outputs.VERSION }} \
--name ${{ steps.version.outputs.VERSION }} \
--description "$(cat $GITHUB_WORKSPACE/CHANGELOG.md)"
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Test Action
# name of the action
name: test

# trigger on pull_request or push events
on:
pull_request:
push:

# pipeline to execute
jobs:
test:
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Validate Action
# name of the action
name: validate

# trigger on pull_request or push events
on:
pull_request:
push:

# pipeline to execute
jobs:
validate:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:

- name: clone
uses: actions/checkout@v1

Expand Down

0 comments on commit 96e59f3

Please sign in to comment.