1# Makefile for releasing.
2#
3# The release is controlled from version.go. The version found there is
4# used to tag the git repo, we're not building any artifacts so there is nothing
5# to upload to github.
6#
7# * Up the version in version.go
8# * Run: make -f Makefile.release release
9#   * will *commit* your change with 'Release $VERSION'
10#   * push to github
11#
12
13define GO
14//+build ignore
15
16package main
17
18import (
19	"fmt"
20
21	"github.com/miekg/dns"
22)
23
24func main() {
25	fmt.Println(dns.Version.String())
26}
27endef
28
29$(file > version_release.go,$(GO))
30VERSION:=$(shell go run version_release.go)
31TAG="v$(VERSION)"
32
33all:
34	@echo Use the \'release\' target to start a release $(VERSION)
35	rm -f version_release.go
36
37.PHONY: release
38release: commit push
39	@echo Released $(VERSION)
40	rm -f version_release.go
41
42.PHONY: commit
43commit:
44	@echo Committing release $(VERSION)
45	git commit -am"Release $(VERSION)"
46	git tag $(TAG)
47
48.PHONY: push
49push:
50	@echo Pushing release $(VERSION) to master
51	git push --tags
52	git push
53