-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.travis.yml
56 lines (51 loc) · 1.88 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
language: go
sudo: false
go:
- 1.9.x
- 1.10.x
- "1.11"
- master
script:
- go test -v ./...
before_deploy:
# Script copied from https://github.com/zabawaba99/go-travis-github-release/
- PLATFORMS=(darwin/amd64 linux/amd64 windows/amd64 linux/arm)
- GOARM=7
- |
for PLATFORM in "${PLATFORMS[@]}"; do
echo "Building $PLATFORM"
GOOS=${PLATFORM%/*}
GOARCH=${PLATFORM#*/}
if [ "$GOOS" = "windows" ]; then
build_syrup_cmd="GOOS=$GOOS GOARCH=$GOARCH go build -o sshsyrup.exe -ldflags '-w -s' ./cmd/syrup"
build_createfs_cmd="GOOS=$GOOS GOARCH=$GOARCH go build -o createfs.exe -ldflags '-w -s' ./cmd/createfs"
else
build_syrup_cmd="CGO_ENABLED=0 GOARM=$GOARM GOOS=$GOOS GOARCH=$GOARCH go build -o sshsyrup -ldflags '-w -s' ./cmd/syrup"
build_createfs_cmd="CGO_ENABLED=0 GOARM=$GOARM GOOS=$GOOS GOARCH=$GOARCH go build -o createfs -ldflags '-w -s' ./cmd/createfs"
fi
if ! eval $build_syrup_cmd; then
echo "Failed building sshsyrup for $PLATFORM" && return 1
fi
if ! eval $build_createfs_cmd; then
echo "Failed building createfs for $PLATFORM" && return 1
fi
if [ "$GOOS" = "windows" ]; then
zip sshsyrup-${TRAVIS_TAG}-${GOOS}-${GOARCH}.zip sshsyrup.exe createfs.exe config.yaml logs/.gitignore logs/sessions/.gitignore cmdOutput/*
else
tar cvzf sshsyrup-${TRAVIS_TAG}-${GOOS}-${GOARCH}.tar.gz sshsyrup createfs config.yaml logs/.gitignore logs/sessions/.gitignore cmdOutput/*
fi
done
- ls
deploy:
provider: releases
api_key: $AUTH_TOKEN
file:
- "sshsyrup-${TRAVIS_TAG}-darwin-amd64.tar.gz"
- "sshsyrup-${TRAVIS_TAG}-linux-amd64.tar.gz"
- "sshsyrup-${TRAVIS_TAG}-linux-arm.tar.gz"
- "sshsyrup-${TRAVIS_TAG}-windows-amd64.zip"
skip_cleanup: true
on:
condition: $TRAVIS_GO_VERSION =~ ^1\.11(\.[0-9]+)?$
branch: master
tags: true