aboutsummaryrefslogtreecommitdiff
path: root/Makefile.release
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2020-11-11 19:00:28 +0100
committerGravatar GitHub <noreply@github.com> 2020-11-11 18:00:28 +0000
commit2299c5b696ba828d37b7e42dc95fc35592dcf837 (patch)
treeece8787f0662f21684f6b61c4b4f7929478b1045 /Makefile.release
parent9178f9d1ee82649a3cb3e015e6150b8fecab8b1a (diff)
downloadcoredns-2299c5b696ba828d37b7e42dc95fc35592dcf837.tar.gz
coredns-2299c5b696ba828d37b7e42dc95fc35592dcf837.tar.zst
coredns-2299c5b696ba828d37b7e42dc95fc35592dcf837.zip
Add make notes target (#4276)
Automatically submitted.
Diffstat (limited to 'Makefile.release')
-rw-r--r--Makefile.release49
1 files changed, 30 insertions, 19 deletions
diff --git a/Makefile.release b/Makefile.release
index 95b881845..6d863e211 100644
--- a/Makefile.release
+++ b/Makefile.release
@@ -1,21 +1,13 @@
# Makefile for releasing CoreDNS
#
# The release is controlled from coremain/version.go. The version found there is
-# used to tag the git repo and to build the assets that are uploaded to github
-# (after some sanity checks).
+# used to tag the git repo and to build the assets that are uploaded to GitHub.
#
# The release should be accompanied by release notes in the notes/ subdirectory.
# These are published on coredns.io. For example see: notes/coredns-1.5.1.md
+# Use make -f Makefile.release notes to create a skeleton notes document.
#
-# Getting the authors for this release is done with the following command line
-# See the 'authors' target.
-#
-# git log --pretty=format:'%an' $(git describe --tags --abbrev=0)..master | sort -u
-#
-# Getting all pull requests merged since the last tag can be done with this "oneliner"
-# See the 'prs' target.
-#
-# % git log $(git describe --tags --abbrev=0)..HEAD --oneline | awk ' { $1="";print } ' | sed 's/^ //' | sed -e 's|#\([0-9]\)|https://github.com/coredns/coredns/pull/\1|'
+# Be sure to prune the PR list a bit, not everything is worthy!
#
# As seen in notes/coredns-1.5.1.md we want to style the notes in the following manner:
#
@@ -65,10 +57,6 @@ DOCKER_IMAGE_NAME:=$(DOCKER)/$(NAME)
LINUX_ARCH:=amd64 arm arm64 ppc64le s390x
PLATFORMS:=$(subst $(SPACE),$(COMMA),$(foreach arch,$(LINUX_ARCH),linux/$(arch)))
-ifeq ($(DOCKER),)
- $(error "Please specify Docker registry to use. Use DOCKER=coredns for releases")
-endif
-
all:
@echo Use the 'release' target to build a release, 'docker' for docker build.
@@ -111,6 +99,9 @@ tar:
.PHONY: github-push
github-push:
+ifeq ($(GITHUB_ACCESS_TOKEN),)
+ $(error "Please set the GITHUB_ACCESS_TOKEN environment variable")
+else
@echo Releasing: $(VERSION)
@$(eval RELEASE:=$(shell curl -s -d '{"tag_name": "v$(VERSION)", "name": "v$(VERSION)"}' -H "Authorization: token ${GITHUB_ACCESS_TOKEN}" "https://api.github.com/repos/$(GITHUB)/$(NAME)/releases" | grep -m 1 '"id"' | tr -cd '[[:digit:]]'))
@echo ReleaseID: $(RELEASE)
@@ -133,9 +124,13 @@ github-push:
--data-binary "@$$asset" \
"https://uploads.github.com/repos/$(GITHUB)/$(NAME)/releases/$(RELEASE)/assets?name=$${asset}" ; \
done )
+endif
.PHONY: docker-build
docker-build: tar
+ifeq ($(DOCKER),)
+ $(error "Please specify Docker registry to use. Use DOCKER=coredns for releases")
+else
@# Steps:
@# 1. Copy appropriate coredns binary to build/docker/linux/<arch>
@# 2. Copy Dockerfile to build/docker/linux/<arch>
@@ -147,9 +142,13 @@ docker-build: tar
docker build -t coredns build/docker/linux/$$arch ;\
docker tag coredns $(DOCKER_IMAGE_NAME):coredns-$$arch ;\
done
+endif
.PHONY: docker-push
docker-push:
+ifeq ($(DOCKER),)
+ $(error "Please specify Docker registry to use. Use DOCKER=coredns for releases")
+else
@echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_LOGIN) --password-stdin
@echo Pushing: $(VERSION) to $(DOCKER_IMAGE_NAME)
for arch in $(LINUX_ARCH); do \
@@ -157,6 +156,7 @@ docker-push:
done
manifest-tool push from-args --platforms $(PLATFORMS) --template $(DOCKER_IMAGE_NAME):coredns-ARCH --target $(DOCKER_IMAGE_NAME):$(VERSION)
manifest-tool push from-args --platforms $(PLATFORMS) --template $(DOCKER_IMAGE_NAME):coredns-ARCH --target $(DOCKER_IMAGE_NAME):latest
+endif
.PHONY: version
version:
@@ -167,12 +167,23 @@ clean:
rm -rf release
rm -rf build
+.PHONY: notes
+notes:
+ @$(MAKE) -s -f Makefile.release authors
+ @echo
+ @$(MAKE) -s -f Makefile.release prs
+
.PHONY: prs
prs:
- git log $$(git describe --tags --abbrev=0)..HEAD --oneline | awk ' { $$1="";print } ' | sed 's/^ //' | sed -e 's|#\([0-9]\)|https://github.com/coredns/coredns/pull/\1|' | \
- grep -v '^build(deps)' | \
- grep -v '^auto go mod tidy'
+ @echo "## Noteworthy Changes"
+ @echo
+ @git log $$(git describe --tags --abbrev=0)..HEAD --oneline | awk ' { $$1="";print } ' | sed 's/^ //' | sed -e 's|#\([0-9]\)|https://github.com/coredns/coredns/pull/\1|' | \
+ grep -v '^build(deps)' | \
+ grep -v '^auto go mod tidy' | grep -v '^auto remove' | grep -v '^auto make' | sed 's/^/* /'
.PHONY: authors
authors:
- git log --pretty=format:'%an' $$(git describe --tags --abbrev=0)..master | sort -u
+ @echo "## Brought to You By"
+ @echo
+ @git log --pretty=format:'%an' $$(git describe --tags --abbrev=0)..master | sort -u | grep -v '^coredns-auto' | grep -v '^dependabot-preview' | \
+ tac | cat -n | sed -e 's/^[[:space:]]\+1[[:space:]]\+\(.*\)/\1./' | sed -e 's/^[[:space:]]\+[[:digit:]]\+[[:space:]]\+\(.*\)/\1,/' | tac # comma separate, with dot at the end