feat: add release-notes target (#1734)

* feat: add release-notes target

* chore(makefile): add template and sv4git config
This commit is contained in:
Vaclav Pavlin 2023-05-18 14:45:45 +02:00 committed by GitHub
parent b148c305d7
commit ceb54b1821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

21
.sv4git.yml Normal file
View File

@ -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.

View File

@ -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}}

View File

@ -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}}

View File

@ -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