Skip to content

Commit

Permalink
update goreleaser and travis
Browse files Browse the repository at this point in the history
  • Loading branch information
cxjava committed Oct 22, 2019
1 parent 0deb131 commit a1ab8ed
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 34 deletions.
68 changes: 45 additions & 23 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
project_name: AriaNg-go

env:
- GO111MODULE=on
- REPO=github.com/cxjava/AriaNg-go

before:
hooks:
- go mod tidy
- go generate ./...
project_name: AriaNg-go

builds:
- env:
- id: default
binary: AriaNg-go
env:
- CGO_ENABLED=0
ldflags:
- "-s -w"
binary: AriaNg-go
- -X "{{.Env.REPO}}/cmd.Version={{.Version}}"
- -X "{{.Env.REPO}}/cmd.Commit={{.FullCommit}}"
- -X "{{.Env.REPO}}/cmd.RepoUrl={{.GitURL}}"
- -X "{{.Env.REPO}}/cmd.BuildDate={{.Date}}"
- -X "{{.Env.REPO}}/cmd.BuiltWithGoVersion={{.Env.GO_VERSION}}"
- -X "{{.Env.REPO}}/cmd.BuiltBy={{.Env.BUILT_BY}}"
flags:
- -tags=release
goos:
Expand All @@ -21,28 +35,36 @@ builds:
goarm:
- 6
- 7
ignore:
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm
hooks:
post: ./upx.sh
archive:
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format: tar.gz
format_overrides:
- goos: windows
format: zip
wrap_in_directory: true
files:
- none*
replacements:
amd64: 64-bit
386: 32-bit
arm: ARM
arm64: ARM64
darwin: macOS
linux: Linux
windows: Windows
openbsd: OpenBSD
netbsd: NetBSD
freebsd: FreeBSD
archives:
- id: binary
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format: tar.gz
format_overrides:
- goos: windows
format: zip
builds:
- default
wrap_in_directory: true
files:
- none*
replacements:
amd64: 64-bit
386: 32-bit
arm: ARM
arm64: ARM64
darwin: macOS
linux: Linux
windows: Windows
openbsd: OpenBSD
netbsd: NetBSD
freebsd: FreeBSD
release:
github:
owner: cxjava
Expand Down
38 changes: 27 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
language: go
sudo: true

go:
- 1.12.x
- 1.13.x

env:
global:
- GORELEASER_VERSION=0.104.3
- GO111MODULE=on
- GORELEASER_VERSION=0.120.2
- ARIANG_VERSION="1.1.4"
- UPXVER="3.94"
before_install:

install:
- curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b $(go env GOPATH)/bin v${GORELEASER_VERSION}
- wget https://github.com/mayswind/AriaNg/releases/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip && unzip -q AriaNg-${ARIANG_VERSION}.zip -d AriaNg
- wget https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_amd64.deb
- sudo dpkg -i goreleaser_amd64.deb
- |
if [[ ! -f "./upx" ]]
then
Expand All @@ -27,9 +28,24 @@ before_install:
- go get -u -v github.com/UnnoTed/fileb0x
- go install github.com/UnnoTed/fileb0x

script:
- goreleaser --skip-validate --skip-sign --debug
deploy:
- provider: script
skip_cleanup: true
script: |
export GO_VERSION="$TRAVIS_GO_VERSION"
export BUILT_BY="$(whoami)@$(hostname)"
export GIT_BRANCH="$TRAVIS_BRANCH"
goreleaser --skip-validate --skip-sign --debug
on:
tags: true

branches:
only:
- master
- provider: script
skip_cleanup: true
script: |
export GO_VERSION="$TRAVIS_GO_VERSION"
export BUILT_BY="$(whoami)@$(hostname)"
export GIT_BRANCH="$TRAVIS_BRANCH"
goreleaser --rm-dist --snapshot --debug
on:
all_branches: true
tags: false

0 comments on commit a1ab8ed

Please sign in to comment.