Browse code

make release: build a binary release of the most recent version tag

Solomon Hykes authored on 2013/04/24 10:32:59
Showing 1 changed files
... ...
@@ -1,5 +1,9 @@
1 1
 DOCKER_PACKAGE := github.com/dotcloud/docker
2
+RELEASE_VERSION := $(shell git tag | grep -E "v[0-9\.]+$$" | sort -nr | head -n 1)
3
+SRCRELEASE := docker-$(RELEASE_VERSION)
4
+BINRELEASE := docker-$(RELEASE_VERSION).tgz
2 5
 
6
+GIT_ROOT := $(shell git rev-parse --show-toplevel)
3 7
 BUILD_DIR := $(CURDIR)/.gopath
4 8
 
5 9
 GOPATH ?= $(BUILD_DIR)
... ...
@@ -23,7 +27,7 @@ DOCKER_MAIN := $(DOCKER_DIR)/docker
23 23
 DOCKER_BIN_RELATIVE := bin/docker
24 24
 DOCKER_BIN := $(CURDIR)/$(DOCKER_BIN_RELATIVE)
25 25
 
26
-.PHONY: all clean test hack
26
+.PHONY: all clean test hack release $(BINRELEASE) $(SRCRELEASE)
27 27
 
28 28
 all: $(DOCKER_BIN)
29 29
 
... ...
@@ -36,6 +40,21 @@ $(DOCKER_DIR):
36 36
 	@mkdir -p $(dir $@)
37 37
 	@ln -sf $(CURDIR)/ $@
38 38
 
39
+whichrelease:
40
+	echo $(RELEASE_VERSION)
41
+
42
+release: $(BINRELEASE)
43
+
44
+$(SRCRELEASE):
45
+	rm -fr $(SRCRELEASE)
46
+	git clone $(GIT_ROOT) $(SRCRELEASE)
47
+	cd $(SRCRELEASE); git checkout -b $(RELEASE_VERSION)
48
+
49
+# A binary release ready to be uploaded to a mirror
50
+$(BINRELEASE): $(SRCRELEASE)
51
+	rm -f $(BINRELEASE)
52
+	cd $(SRCRELEASE); make; cp -R bin docker-$(RELEASE_VERSION); tar -f ../$(BINRELEASE) -zv -c docker-$(RELEASE_VERSION)
53
+
39 54
 clean:
40 55
 	@rm -rf $(dir $(DOCKER_BIN))
41 56
 ifeq ($(GOPATH), $(BUILD_DIR))