-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
82 lines (76 loc) · 1.57 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
language: go
go:
- 1.11.x
env:
global:
- REPO_OWNER=guangie88
- REPO_NAME=terraform-provider-smallutil
matrix:
fast_finish: true
include:
# Do not use GOOS and GOARCH because Travis will reinitialize these env vars
# when bootstrapping Golang set-up
- env:
- goos=linux
- goarch=386
- ldflags=""
- env:
- goos=linux
- goarch=amd64
- ldflags=""
- env:
- goos=linux
- goarch=arm
- ldflags=""
- env:
- goos=linux
- goarch=arm64
- ldflags=""
- env:
- goos=darwin
- goarch=386
- ldflags=""
- env:
- goos=darwin
- goarch=amd64
- ldflags=""
- env:
- goos=windows
- goarch=386
- ldflags=""
- env:
- goos=windows
- goarch=amd64
- ldflags=""
script:
- printf -- "--------\n${goos}_${goarch} (ldflag \"${ldflags}\")\n--------\n"
- go test ./...
- env GOOS=${goos} GOARCH=${goarch} go build -v -ldflags "${ldflags}"
- |-
if [ "${goos}" = "windows" ]; then
EXE_SUFFIX=".exe"
else
EXE_SUFFIX=
fi
- file ${REPO_NAME}${EXE_SUFFIX}
- |-
if [ -z "${TRAVIS_TAG}" ]; then
TAG_SUFFIX=
else
echo "TRAVIS_TAG is ${TRAVIS_TAG}"
TAG_SUFFIX=_${TRAVIS_TAG}
mv ${REPO_NAME}${EXE_SUFFIX} ${REPO_NAME}${TAG_SUFFIX}${EXE_SUFFIX}
fi
- zip -j ${REPO_NAME}_${goos}_${goarch}${TAG_SUFFIX}.zip ${REPO_NAME}${TAG_SUFFIX}${EXE_SUFFIX}
deploy:
provider: releases
api_key: "${GITHUB_TOKEN}"
file: "${REPO_NAME}_${goos}_${goarch}${TAG_SUFFIX}.zip"
skip_cleanup: true
on:
tags: true
branches:
only:
- master
- /^release-v.+\..+\..+$/
- /^v\d+\.\d+\.\d+(-\S*)?$/