Debian Codegraph @

Makefile.release

raw
1 # Makefile for releasing CoreDNS
2 #
3 # The release is controlled from markdown.go. The version found
4 # there is used to tag the git repo and to build the assets that are
5 # uploaded to github (after some sanity checks).
6 #
7 # We use https://github.com/progrium/gh-release to automate github stuff
8 # be sure to have that binary in your path.
9 #
10 # Steps:
11 # * Get an access token: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
12 # * export GITHUB_ACCESS_TOKEN=<token>
13 # * Up the version in markdown.go
14 # * Run: make -f Makefile.release
15 # * will commit your change with 'Release $VERSION'
16 # * push to github
17 # * build the release and do all that fluff.
18 NAME:=mmark
19 VERSION:=$(shell grep 'Version' markdown.go | awk '{ print $$4 }' | tr -d '"')
20 ARCH:=$(shell uname -m)
21 GITHUB:=miekg
22
23 all: commit push build tar release
24
25 .PHONY: push
26 push:
27 @echo Pushing release to master
28 git push
29
30 .PHONY: commit
31 commit:
32 @echo Committing
33 @git commit -am"Release $(VERSION)"
34 exit 0
35
36 .PHONY: build
37 build: build-arm build-darwin build-linux
38
39 .PHONY: build-linux
40 build-linux:
41 @echo Building: linux $(VERSION)
42 mkdir -p build/Linux && cd mmark && CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o ../build/Linux/$(NAME)
43
44 .PHONY: build-darwin
45 build-darwin:
46 @echo Building: darwin $(VERSION)
47 mkdir -p build/Darwin && cd mmark && CGO_ENABLED=0 GOOS=darwin go build -ldflags="-s -w" -o ../build/Darwin/$(NAME)
48
49 .PHONY: build-arm
50 build-arm:
51 @echo Building: arm $(VERSION)
52 mkdir -p build/Linux/Arm && cd mmark && CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags="-s -w" -o ../build/Linux/Arm/$(NAME)
53
54
55 .PHONY: tar
56 tar:
57 rm -rf release && mkdir release
58 tar -zcf release/$(NAME)_$(VERSION)_linux_$(ARCH).tgz -C build/Linux $(NAME)
59 tar -zcf release/$(NAME)_$(VERSION)_linux_armv6l.tgz -C build/Linux/Arm $(NAME)
60 tar -zcf release/$(NAME)_$(VERSION)_darwin_$(ARCH).tgz -C build/Darwin $(NAME)
61
62 .PHONY: release
63 release:
64 @echo Releasing: $(VERSION)
65 gh-release create $(GITHUB)/$(NAME) $(VERSION)
66
67 .PHONY: clean
68 clean:
69 rm -rf release
70 rm -rf build