From 3616a4549b2ff86d06c8b0be9d18418510412dac Mon Sep 17 00:00:00 2001 From: James Mills Date: Mon, 27 Jul 2020 11:07:06 +1000 Subject: [PATCH] Fix goreleaser config and improve release notes / changelog --- .chglog/CHANGELOG.tpl.md | 22 ++++++++++++++++++++++ .chglog/config.yml | 28 ++++++++++++++++++++++++++++ .goreleaser.yml | 22 ++++++++++------------ tools/release.sh | 19 +++++++++++++------ 4 files changed, 73 insertions(+), 18 deletions(-) create mode 100755 .chglog/CHANGELOG.tpl.md create mode 100755 .chglog/config.yml diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 0000000..a872639 --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,22 @@ +{{ range .Versions }} + +## {{ 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 -}} +* {{ .Subject }} +{{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} + +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} \ No newline at end of file diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 0000000..38e34f9 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,28 @@ +--- +style: Github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/prologic/bitcask +options: + commits: + filters: + Type: + - Add + - Fix + - Update + - Document + commit_groups: + title_maps: + Add: Features + Update: Updates + Fix: Bug Fixes + Document: Documentation + header: + pattern: "^((\\w+)\\s.*)$" + pattern_maps: + - Subject + - Type + notes: + keywords: + - BREAKING CHANGE diff --git a/.goreleaser.yml b/.goreleaser.yml index 299475b..645de6b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,12 +1,13 @@ +--- builds: - - + - binary: bitcask main: ./cmd/bitcask flags: -tags "static_build" ldflags: -w -X github.com/prologic/bitcask/internal.Version={{.Version}} -X github.com/prologic/bitcask/internal.Commit={{.Commit}} env: - CGO_ENABLED=0 - - + - binary: bitcaskd main: ./cmd/bitcaskd flags: -tags "static_build" @@ -22,13 +23,10 @@ archive: windows: Windows 386: i386 amd64: x86_64 -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ .Tag }}-next" -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' +signs: + - artifacts: checksum +release: + github: + owner: prologic + name: bitcask + draft: true diff --git a/tools/release.sh b/tools/release.sh index e8ab44e..cd35f79 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,16 +1,19 @@ -#!/bin/sh +#!/bin/bash # Get the highest tag number VERSION="$(git describe --abbrev=0 --tags)" VERSION=${VERSION:-'0.0.0'} # Get number parts -MAJOR="${VERSION%%.*}"; VERSION="${VERSION#*.}" -MINOR="${VERSION%%.*}"; VERSION="${VERSION#*.}" -PATCH="${VERSION%%.*}"; VERSION="${VERSION#*.}" +MAJOR="${VERSION%%.*}" +VERSION="${VERSION#*.}" +MINOR="${VERSION%%.*}" +VERSION="${VERSION#*.}" +PATCH="${VERSION%%.*}" +VERSION="${VERSION#*.}" # Increase version -PATCH=$((PATCH+1)) +PATCH=$((PATCH + 1)) TAG="${1}" @@ -20,6 +23,10 @@ fi echo "Releasing ${TAG} ..." +git-chglog --next-tag="${TAG}" --output CHANGELOG.md +git commit -a -m "Update CHANGELOG for ${TAG}" git tag -a -s -m "Release ${TAG}" "${TAG}" git push --tags -goreleaser release --rm-dist +goreleaser release \ + --rm-dist \ + --release-notes <(git-chglog "${TAG}" | tail -n+5)