Skip to content

Commit

Permalink
feat: add release-notes target (#1734)
Browse files Browse the repository at this point in the history
* feat: add release-notes target

* chore(makefile): add template and sv4git config
  • Loading branch information
vpavlin authored May 18, 2023
1 parent b148c30 commit ceb54b1
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .sv4git.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "1.1" #config version

tag:
pattern: "v%d.%d.%d"

release-notes:
sections: # Array with each section of release note. Check template section for more information.
- name: Features # Name used on section.
section-type: commits # Type of the section, supported types: commits, breaking-changes.
commit-types: [feat] # Commit types for commit section-type, one commit type cannot be in more than one section.
- name: Bug Fixes
section-type: commits
commit-types: [fix, bug]
- name: Changes
section-type: commits
commit-types: [chore, docs, build, refactor, docker]

commit-message:

issue:
regex: '#[0-9]+' # Regex for issue id.
8 changes: 8 additions & 0 deletions .sv4git/templates/releasenotes-md.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## {{if .Release}}{{.Release}}{{end}}{{if and (not .Date.IsZero) .Release}} ({{end}}{{timefmt .Date "2006-01-02"}}{{if and (not .Date.IsZero) .Release}}){{end}}
{{- range $section := .Sections }}
{{- if (eq $section.SectionType "commits") }}
{{- template "rn-md-section-commits.tpl" $section }}
{{- else if (eq $section.SectionType "breaking-changes")}}
{{- template "rn-md-section-breaking-changes.tpl" $section }}
{{- end}}
{{- end}}
7 changes: 7 additions & 0 deletions .sv4git/templates/rn-md-section-commits.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- if .}}{{- if ne .SectionName ""}}

### {{.SectionName}}
{{range $k,$v := .Items}}
- {{if $v.Message.Scope}}**{{$v.Message.Scope}}:** {{end}}{{$v.Message.Description}} ([{{$v.Hash}}](https://github.com/waku-org/nwaku/commit/{{$v.Hash}})){{if $v.Message.Metadata.issue}} ([https://github.com/waku-org/nwaku/issues/{{$v.Message.Metadata.issue}}]({{$v.Message.Metadata.issue}})){{end}}
{{- end}}
{{- end}}{{- end}}
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,19 @@ cwaku_example: | build cbindings
vendor/nim-libbacktrace/install/usr/lib/libbacktrace.a

endif # "variables.mk" was not included

###################
# Release Targets #
###################

release-notes:
docker run \
-it \
--rm \
-v $${PWD}:/opt/sv4git/repo:z \
-u $(shell id -u) \
docker.io/wakuorg/sv4git:latest \
release-notes |\
sed -E 's@#([0-9]+)@[#\1](https://github.com/waku-org/nwaku/issues/\1)@g'
# I could not get the tool to replace issue ids with links, so using sed for now,
# asked here: https://github.com/bvieira/sv4git/discussions/101

0 comments on commit ceb54b1

Please sign in to comment.