diff --git a/.sv4git.yml b/.sv4git.yml new file mode 100644 index 000000000..325d9204a --- /dev/null +++ b/.sv4git.yml @@ -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. \ No newline at end of file diff --git a/.sv4git/templates/releasenotes-md.tpl b/.sv4git/templates/releasenotes-md.tpl new file mode 100644 index 000000000..a513e692b --- /dev/null +++ b/.sv4git/templates/releasenotes-md.tpl @@ -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}} diff --git a/.sv4git/templates/rn-md-section-commits.tpl b/.sv4git/templates/rn-md-section-commits.tpl new file mode 100644 index 000000000..2732fcd54 --- /dev/null +++ b/.sv4git/templates/rn-md-section-commits.tpl @@ -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}} \ No newline at end of file diff --git a/Makefile b/Makefile index 6be1d3401..735ef771d 100644 --- a/Makefile +++ b/Makefile @@ -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