Merge pull request #1220 from stevvooe/release-target
Makefile: add release target
This commit is contained in:
		
							
								
								
									
										15
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								Makefile
									
									
									
									
									
								
							| @@ -8,8 +8,6 @@ DESTDIR=/usr/local | |||||||
| VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) | VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) | ||||||
| REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) | REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) | ||||||
|  |  | ||||||
| PKG=github.com/containerd/containerd |  | ||||||
|  |  | ||||||
| ifneq "$(strip $(shell command -v go 2>/dev/null))" "" | ifneq "$(strip $(shell command -v go 2>/dev/null))" "" | ||||||
| GOOS ?= $(shell go env GOOS) | GOOS ?= $(shell go env GOOS) | ||||||
| else | else | ||||||
| @@ -21,6 +19,11 @@ ifeq ("$(OS)", "Windows_NT") | |||||||
| 	WHALE="+" | 	WHALE="+" | ||||||
| 	ONI="-" | 	ONI="-" | ||||||
| endif | endif | ||||||
|  | GOARCH ?= $(shell go env GOARCH) | ||||||
|  |  | ||||||
|  | RELEASE=containerd-$(VERSION:v%=%).${GOOS}-${GOARCH} | ||||||
|  |  | ||||||
|  | PKG=github.com/containerd/containerd | ||||||
|  |  | ||||||
| # Project packages. | # Project packages. | ||||||
| PACKAGES=$(shell go list ./... | grep -v /vendor/) | PACKAGES=$(shell go list ./... | grep -v /vendor/) | ||||||
| @@ -43,7 +46,7 @@ GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revi | |||||||
| # Flags passed to `go test` | # Flags passed to `go test` | ||||||
| TESTFLAGS ?=-parallel 8 -race | TESTFLAGS ?=-parallel 8 -race | ||||||
|  |  | ||||||
| .PHONY: clean all AUTHORS fmt vet lint dco build binaries test integration setup generate protos checkprotos coverage ci check help install uninstall vendor | .PHONY: clean all AUTHORS fmt vet lint dco build binaries test integration setup generate protos checkprotos coverage ci check help install uninstall vendor release | ||||||
| .DEFAULT: default | .DEFAULT: default | ||||||
|  |  | ||||||
| all: binaries | all: binaries | ||||||
| @@ -142,6 +145,12 @@ bin/%: cmd/% FORCE | |||||||
| binaries: $(BINARIES) ## build binaries | binaries: $(BINARIES) ## build binaries | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
|  |  | ||||||
|  | release: $(BINARIES) | ||||||
|  | 	@echo "$(WHALE) $@" | ||||||
|  | 	@mkdir -p releases/${RELEASE} | ||||||
|  | 	@cp $(BINARIES) releases/$(RELEASE)/ | ||||||
|  | 	@cd releases/$(RELEASE) && tar -czf ../$(RELEASE).tar.gz * | ||||||
|  |  | ||||||
| clean: ## clean up binaries | clean: ## clean up binaries | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
| 	@rm -f $(BINARIES) | 	@rm -f $(BINARIES) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stephen Day
					Stephen Day