From 3af4f5061972fe01b12527ac74df7d38878d8504 Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Fri, 9 Dec 2022 16:18:28 -0600 Subject: [PATCH] updating relase notes generation --- .gitignore | 2 +- Makefile | 15 ++++++++++++--- build/releasenotes.pl | 9 +++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 build/releasenotes.pl diff --git a/.gitignore b/.gitignore index b85cdee83..fb0034cec 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,4 @@ dist/ *.app *.hugo_build.lock *~ - +.RELEASE.CHANGELOG.md diff --git a/Makefile b/Makefile index 05a08cc80..c89a6cb25 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ LAST_TAG ?= $(shell git describe --tags --first-parent --abbrev=0) # e.g. 1.5.5 VERSION ?= $(shell git describe --tags --first-parent --abbrev=0 | cut -c 2-) + # GOFLAGS is the flags for the go compiler. GOFLAGS ?= -mod=vendor -ldflags "-X main.version=$(CUR_TAG)" @@ -112,11 +113,19 @@ tag: build/tag.sh # gorelease runs goreleaser to build and publish the artifacts -.PHONY: gorelease -gorelease: +.PHONY: gorelease .RELEASE.CHANGELOG.md +gorelease: changelog + [ -x "$(GORELEASER)" ] || ( echo "goreleaser not installed"; exit 1) + GOVERSION=$(GOVERSION) goreleaser --rm-dist --release-notes=.RELEASE.CHANGELOG.md + +.PHONY: goreleasedryrun +goreleasedryrun: changelog [ -x "$(GORELEASER)" ] || ( echo "goreleaser not installed"; exit 1) - GOVERSION=$(GOVERSION) goreleaser --rm-dist + GOVERSION=$(GOVERSION) goreleaser --rm-dist --skip-publish --skip-validate --release-notes=.RELEASE.CHANGELOG.md +.PHONY: changelog +changelog: + RELEASE=$(CUR_TAG) build/releasenotes.pl .RELEASE.CHANGELOG.md # homebrew updates the brew recipe since goreleaser can only # handle taps right now. .PHONY: homebrew diff --git a/build/releasenotes.pl b/build/releasenotes.pl new file mode 100755 index 000000000..f1f1a09d4 --- /dev/null +++ b/build/releasenotes.pl @@ -0,0 +1,9 @@ +#!/usr/bin/env perl + +use strict; + +local $/; +$_ = <>; +if (/^### \[$ENV{RELEASE}.*?\n\s*(.*?)^### \[v/gms) { + print $1; +};