diff --git a/.gitignore b/.gitignore index 8684a63..ea0c39a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ _testmain.go *.prof cast release/ +/dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..cfdace6 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,23 @@ +builds: + - binary: cast + main: ./cmd/cast + ldflags: -s -w -X=github.com/barnybug/go-cast.Version={{.Version}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - 386 + - arm + - arm64 + ignore: + - goos: darwin + goarch: 386 + hooks: + post: make upx +archive: + name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" + format: binary + replacements: + darwin: mac diff --git a/.travis.yml b/.travis.yml index 320314f..5e77665 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,10 @@ language: go go: -- 1.7 -- tip +- '1.10' sudo: false before_script: - 'mkdir -p $GOPATH/bin && wget -q https://github.com/barnybug/go-cast/releases/download/deps/upx -O $GOPATH/bin/upx && chmod +x $GOPATH/bin/upx' script: -- make deps build test -before_deploy: -- make release -deploy: - provider: releases - api_key: - secure: pC1oVY2F5AKp39oxzpTVEiwNZN4R7QCScbP49x++45j9G7ZenoxTR2tuFC1tGtXtgcarfLksO124Ny+zb08SbwiocbmUVejGAyize6Vvq6shDsBopg7ognzHSBdt8LTzYdmKmvgUEs6ZipXPJduSHPbk7LknAAgWB1UCJBhrn9CvLU0+vEFRIMizj0dxarD4x4kYA0cJVpMK8MZYTQefVFCGTcq8uh/65C+AN+SCoNEvkZzkZK8KgB6BDDsTvgc8rrCOAAne+24/IuSzzq+1tOO3VruyFZWyduC+98S0XGl80a8l5WjtCBUz9vvxzrLNZ3rPjpgtAosREo9MSaANxSQZy8MKY1V48I1DEs/mj5RKmjHaXnsm0TtIOQUlQYC0Y3wGSJ01EQtsSpUdhwHkIgGscY0M8FrxfOGp1au8AI2IHjeDN32LztDsP2KcySGXYlHfWppBKObEhoBk8H/EkrIxTuwsdAPFFiID/mcG+W2+2ZpF44bCBoMpF1p04ysATEznZqnWDV1cLSTdzwXPHGRRQhESM+REc1BSlMr2lDfI8m6duj3ogBfm7YXJIVogN8IZSsFviWQ1sOxa7MplRpJrf+f82JCnMAsf/JiXvSu+Uwesoic3IAGQYe34AxvMKKlyIZaa8MkBBtoEP3daiMwNdGaySx3pBP4GQEYrRcE= - file: - - release/cast-linux-386 - - release/cast-linux-amd64 - - release/cast-linux-arm - - release/cast-mac-amd64 - - release/cast-windows-386.exe - - release/cast-windows-amd64.exe - on: - repo: barnybug/go-cast - tags: true +- make test +after_success: + - test -n "$TRAVIS_TAG" && curl -sL https://git.io/goreleaser | bash diff --git a/Makefile b/Makefile index 309e23c..1051f34 100644 --- a/Makefile +++ b/Makefile @@ -28,3 +28,7 @@ release: GOOS=windows GOARCH=amd64 go build $(buildargs) -o release/cast-windows-amd64.exe $(exe) goupx release/cast-linux-amd64 upx release/cast-linux-386 release/cast-linux-arm release/cast-windows-386.exe + +upx: + goupx dist/cast-linux-amd64/cast-linux-amd64 + upx dist/cast-linux-386/cast-linux-386 dist/cast-linux-arm/cast-linux-arm dist/cast-windows-386/cast-windows-386.exe