From 65f88a2ac536a758870681eb246275d4957abc2b Mon Sep 17 00:00:00 2001 From: Gosuke Miyashita Date: Thu, 17 Jan 2019 14:04:56 +0900 Subject: [PATCH] Arrange things related to release and maintenances --- .gitignore | 2 +- Makefile | 23 ++++++++++++++++++++--- go.mod | 1 + go.sum | 27 +++++++++++++++++++++++++++ scripts/bump.sh | 14 ++++++++++++++ scripts/package.sh | 15 +++++++++++++++ 6 files changed, 78 insertions(+), 4 deletions(-) create mode 100755 scripts/bump.sh create mode 100755 scripts/package.sh diff --git a/.gitignore b/.gitignore index 96bda74..e29ef2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ bin/atgen - +pkg/ diff --git a/Makefile b/Makefile index 90c86ae..51a1a55 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -NAME := atge -VERSION = $(shell gobump show -r ./version) +NAME := atgen +VERSION = $(shell gobump show -r) REVISION := $(shell git rev-parse --short HEAD) all: build @@ -22,4 +22,21 @@ fmt: setup goimports -w . build: - go build + go build -o ./bin/$(NAME) + +clean: + rm bin/$(NAME) + +package: setup + @sh -c "'$(CURDIR)/scripts/package.sh'" + +crossbuild: setup + goxz -pv=v${VERSION} -build-ldflags="-X main.GitCommit=${REVISION}" \ + -arch=386,amd64 -d=./pkg/dist/v${VERSION} \ + -n ${NAME} + +release: package + ghr -u aktsk v${VERSION} ./pkg/dist/v${VERSION} + +bump: + @sh -c "'$(CURDIR)/scripts/bump.sh'" diff --git a/go.mod b/go.mod index 870c7a3..fc7b11e 100644 --- a/go.mod +++ b/go.mod @@ -4,4 +4,5 @@ require ( github.com/mizzy/atgen v0.0.0-20190117015632-10d546d723c4 github.com/pkg/errors v0.8.1 github.com/urfave/cli v1.20.0 + golang.org/x/tools v0.0.0-20190116231616-b258f6da2383 // indirect ) diff --git a/go.sum b/go.sum index db57f79..d375fd0 100644 --- a/go.sum +++ b/go.sum @@ -1,42 +1,69 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/Songmu/goxz v0.1.1 h1:Mtwfo7UYe6CHGiixyIk/2PCsyDZEQ/o7e/O7lLsScZg= github.com/Songmu/goxz v0.1.1/go.mod h1:nmwtXnff39nrvYo3eu3es2OigsPCIIDl2EAw+k5Icyc= +github.com/Songmu/retry v0.1.0 h1:hPA5xybQsksLR/ry/+t/7cFajPW+dqjmjhzZhioBILA= github.com/Songmu/retry v0.1.0/go.mod h1:7sXIW7eseB9fq0FUvigRcQMVLR9tuHI0Scok+rkpAuA= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 h1:eX+pdPPlD279OWgdx7f6KqIRSONuK7egk+jDx7OM3Ac= github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76/go.mod h1:KjxHHirfLaw19iGT70HvVjHQsL1vq1SRQB4yOsAfy2s= +github.com/golang/lint v0.0.0-20181217174547-8f45f776aaf1 h1:6DVPu65tee05kY0/rciBQ47ue+AnuY8KTayV6VHikIo= github.com/golang/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/lkesteloot/astutil v0.0.0-20130122170032-b6715328cfa5 h1:+nqKYezU5GyIBrmg+EPulKqtzFP4e2/2N1XI49X8d/A= github.com/lkesteloot/astutil v0.0.0-20130122170032-b6715328cfa5/go.mod h1:5EJrn5eOawLeALv3b2JE+RDh3jrm7yrzNBiMW8LZGyQ= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= +github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 h1:KHyL+3mQOF9sPfs26lsefckcFNDcIZtiACQiECzIUkw= github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mizzy/atgen v0.0.0-20190117015632-10d546d723c4 h1:M+wzlXRb4MeYludLvtsf7XQPLJgeu2HEGctXYtuNRkQ= github.com/mizzy/atgen v0.0.0-20190117015632-10d546d723c4/go.mod h1:o5gdBqxqL80j7CI66rWHrxVKOHOttPBFTkR9r+fOJLY= +github.com/motemen/gobump v0.0.0-20170609005736-b5563e1d8b75 h1:u86Q2ngUdcfDmyFxHoQXMVdxpsOZpLJCjZ7b5izUrEQ= github.com/motemen/gobump v0.0.0-20170609005736-b5563e1d8b75/go.mod h1:bJBHskFfPJ5RT+ERdz949lt6jPVTKl2v3KjIbbeQx/A= +github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs= github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= +github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/tcnksm/ghr v0.12.0 h1:3dbJOU5/Nr6C1HeBWwOIvMsVt4/eOg2EQDAg11H0Y0Y= github.com/tcnksm/ghr v0.12.0/go.mod h1:2YSVCxP2GsVRnE6R3bZxEiVnpJ9GUkotqlq2No0kTMU= +github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw= github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE= +github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e h1:IWllFTiDjjLIf2oeKxpIUmtiDV5sn71VgeQgg6vcE7k= github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e/go.mod h1:d7u6HkTYKSv5m6MCKkOQlHwaShTMl3HjqSGW3XtVhXM= +github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 h1:rJm0LuqUjoDhSk2zO9ISMSToQxGz7Os2jRiOL8AWu4c= golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c h1:pcBdqVcrlT+A3i+tWsOROFONQyey9tisIQHI4xqVGLg= golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190116002428-2e4132e53b93 h1:SYiIcPVdcmdmy24ci5s8I4kx1h+vPqnTDvbu3iG9seI= golang.org/x/tools v0.0.0-20190116002428-2e4132e53b93/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190116231616-b258f6da2383 h1:CWP4O+Q3OaGBOLxV1/YRnzRSpvZYJlauwRUu3auRH5s= +golang.org/x/tools v0.0.0-20190116231616-b258f6da2383/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= diff --git a/scripts/bump.sh b/scripts/bump.sh new file mode 100755 index 0000000..7b3741b --- /dev/null +++ b/scripts/bump.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +echo current version: $(gobump show -r) + +read -p "input next version: " next_version + +gobump set $next_version -w +ghch -w -N v$next_version + +git commit -am "Checking in changes prior to tagging of version v$next_version" +git tag v$next_version +git push && git push --tags diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100755 index 0000000..ea34463 --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +DIR=$(cd $(dirname ${0})/.. && pwd) +cd ${DIR} + +test -d pkg && rm -rf ./pkg +make crossbuild + +VERSION=$(gobump show -r) + +# Generate shasum +pushd ./pkg/dist/v${VERSION} +shasum -a 256 * > ./v${VERSION}_SHASUMS +popd