1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2025-12-17 01:27:01 +00:00

Add support for creating GitHub Releases page

This commit is contained in:
teru
2016-08-22 15:15:08 +09:00
parent 0926ffd318
commit b52a7cde7f
3 changed files with 65 additions and 1 deletions

7
.gitignore vendored
View File

@@ -1 +1,6 @@
/cli/mailfull/mailfull
/vendor
/build
/release
/github_token
/cmd/mailfull/mailfull

6
Gomfile Normal file
View File

@@ -0,0 +1,6 @@
gom 'github.com/BurntSushi/toml'
gom 'github.com/armon/go-radix'
gom 'github.com/bgentry/speakeasy'
gom 'github.com/jsimonetti/pwscheme'
gom 'github.com/mattn/go-isatty'
gom 'github.com/mitchellh/cli'

53
Makefile Normal file
View File

@@ -0,0 +1,53 @@
GOVERSION=$(shell go version)
GOOS=$(word 1,$(subst /, ,$(lastword $(GOVERSION))))
GOARCH=$(word 2,$(subst /, ,$(lastword $(GOVERSION))))
DIR_BUILD=build
DIR_RELEASE=release
VERSION=$(patsubst "%",%,$(lastword $(shell grep 'const Version' version.go)))
.PHONY: build build-linux-amd64 build-linux-386 clean
default: build
installdeps:
gom install
build:
go build -ldflags "-X main.gittag=`git rev-parse --short HEAD`" -v -o build/mailfull_$(GOOS)_$(GOARCH)/mailfull cmd/mailfull/main.go
build-linux-amd64:
docker run --rm -v $(PWD):/go/src/github.com/directorz/mailfull-go -w /go/src/github.com/directorz/mailfull-go \
-e GOOS=linux -e GOARCH=amd64 golang:1.7 \
go build -ldflags "-X main.gittag=`git rev-parse --short HEAD`" -v -o "build/mailfull_linux_amd64/mailfull" cmd/mailfull/main.go
build-linux-386:
docker run --rm -v $(PWD):/go/src/github.com/directorz/mailfull-go -w /go/src/github.com/directorz/mailfull-go \
-e GOOS=linux -e GOARCH=386 golang:1.7 \
go build -ldflags "-X main.gittag=`git rev-parse --short HEAD`" -v -o "build/mailfull_linux_386/mailfull" cmd/mailfull/main.go
release: release-linux-amd64 release-linux-386
release-linux-amd64: build-linux-amd64
@$(MAKE) release-doc release-targz GOOS=linux GOARCH=amd64
release-linux-386: build-linux-386
@$(MAKE) release-doc release-targz GOOS=linux GOARCH=386
release-doc:
cp -a README.md doc $(DIR_BUILD)/mailfull_$(GOOS)_$(GOARCH)
release-targz: dir-$(DIR_RELEASE)
tar zcfp $(DIR_RELEASE)/mailfull_$(GOOS)_$(GOARCH).tar.gz -C $(DIR_BUILD) mailfull_$(GOOS)_$(GOARCH)
dir-$(DIR_RELEASE):
mkdir -p $(DIR_RELEASE)
release-upload: release-linux-amd64 release-linux-386 release-github-token
ghr -u directorz -r mailfull-go -t $(shell cat github_token) --replace --draft $(VERSION) $(DIR_RELEASE)
release-github-token: github_token
@echo "file \"github_token\" is required"
clean:
-rm -rf $(DIR_BUILD)
-rm -rf $(DIR_RELEASE)