Skip to content

Commit

Permalink
feat(changelog-tool): add changelog command line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
vm-001 committed Sep 20, 2023
1 parent 682f262 commit 079fe1f
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test:
rm -rf kong
git clone https://github.com/Kong/kong.git
rm -f 1.0.0.md
echo "# 1.0.0" > 1.0.0.md
# use CHANGELOG/unreleased/kong to generate Kong system changelog
go build && ./changelog generate --repo Kong/kong --repo_path kong --changelog_path CHANGELOG/unreleased/kong --system Kong >> 1.0.0.md
# use CHANGELOG/unreleased/kong to generate Kong-enterprise system changelog
go build && ./changelog generate --repo Kong/kong --repo_path kong --changelog_path CHANGELOG/unreleased/kong --system Kong-enterprise >> 1.0.0.md
28 changes: 28 additions & 0 deletions changelog-markdown.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- /* ===== entry template ==== */ -}}
{{ define "entry" }}
- {{ $.Message }}
{{ range $i, $github := $.ParsedGithubs }} [{{ $github.Name }}]({{ $github.Link }}) {{ end }}
{{ range $i, $jira := $.ParsedJiras }} [{{ $jira.ID }}]({{ $jira.Link }}) {{ end }}
{{- end }}
{{- /* ===== entry template ==== */ -}}
{{- /* ==== section template ==== */ -}}
{{ define "section" }}
{{- if .scopes }}
{{- $length := len .scopes }}
{{- if gt $length 0 }}
### {{ .sectionName }}
{{ range $i, $scope := .scopes }}
#### {{ $scope.ScopeName }}
{{ range $j, $entry := $scope.Entries }} {{ template "entry" $entry }} {{ end }}
{{ end }}
{{- end }}
{{- end }}
{{- end }}
{{- /* ==== section template ==== */ -}}
## {{ .System }}
{{ template "section" (dict "sectionName" "Performance" "scopes" .Type.performance) }}
{{ template "section" (dict "sectionName" "Breaking Changes" "scopes" .Type.breaking_change ) }}
{{ template "section" (dict "sectionName" "Deprecations" "scopes" .Type.deprecation ) }}
{{ template "section" (dict "sectionName" "Dependencies" "scopes" .Type.dependency ) }}
{{ template "section" (dict "sectionName" "Features" "scopes" .Type.feature ) }}
{{ template "section" (dict "sectionName" "Fixes" "scopes" .Type.bugfix ) }}
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module konghq.com/changelog

go 1.20

require (
github.com/urfave/cli/v2 v2.25.7
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
)
Loading

0 comments on commit 079fe1f

Please sign in to comment.