forked from depado/goploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
137 lines (127 loc) · 3.33 KB
/
.drone.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
workspace:
base: /go
path: src/github.com/Depado/goploader/
matrix:
TAG:
- 1.9
- 1.8
ARCH:
- arm
- amd64
pipeline:
# Ensure dep and rice commands are installed, and use dep for vendoring
prerequisites:
image: golang:${TAG}
commands:
- go get -u github.com/golang/dep/cmd/dep
- go get github.com/GeertJohan/go.rice/rice
- dep ensure
# Build the server
server-build:
image: golang:${TAG}
group: build
commands:
- go build -o server/server ./server
environment:
- GOARCH=${ARCH}
- CGO_ENABLED=0
# Build client
client-build:
image: golang:${TAG}
group: build
commands:
- go build -o client/client ./client
environment:
- GOARCH=${ARCH}
- CGO_ENABLED=0
# Release only for the latest stable version of Go
server-release:
image: golang:${TAG}
commands:
- mkdir goploader-server
- rice embed-go -i=github.com/Depado/goploader/server
- go build -o goploader-server/server-standalone github.com/Depado/goploader/server
- tar czf server-standalone_${ARCH}.tar.gz goploader-server
- rm -r goploader-server/*
- rice clean -i=github.com/Depado/goploader/server
- cp -r server/assets/ server/templates/ goploader-server/
- go build -o goploader-server/server github.com/Depado/goploader/server
- tar czf server_${ARCH}.tar.gz goploader-server/
environment:
- GOARCH=${ARCH}
- CGO_ENABLED=0
when:
matrix:
TAG: 1.9
# Copy the built releases
server-release-scp:
image: appleboy/drone-scp
host: gpldr.in
username: depado
target: /home/depado/goploader/releases/servers/
source:
- server_${ARCH}.tar.gz
- server-standalone_${ARCH}.tar.gz
secrets:
- source: deploy_key
target: scp_key
when:
status: success
matrix:
TAG: 1.9
# Build the deployable version (embedded assets, 1.9 version and arm arch)
server-deploy-build:
image: golang:${TAG}
group: build
commands:
- rice embed-go -i=github.com/Depado/goploader/server
- go build -o server/server-new github.com/Depado/goploader/server
- rice clean -i=github.com/Depado/goploader/server
environment:
- GOARCH=${ARCH}
- CGO_ENABLED=0
when:
matrix:
TAG: 1.9
ARCH: arm
# Copy the deployable version
server-deploy-scp:
image: appleboy/drone-scp
host: gpldr.in
username: depado
target: /home/depado/goploader/new/
source: ./server/server-new
secrets:
- source: deploy_key
target: scp_key
when:
status: success
matrix:
TAG: 1.9
ARCH: arm
# Executed only once (only one matrix)
client-release:
image: golang:${TAG}
commands:
- go get github.com/mitchellh/gox
- mkdir clients
- gox -output="clients/client_{{.OS}}_{{.Arch}}" github.com/Depado/goploader/client
- tar czf clients.tar.gz clients
when:
matrix:
TAG: 1.9
ARCH: amd64
# Executed only once (only one matrix)
client-release-scp:
image: appleboy/drone-scp
host: gpldr.in
username: depado
target: /home/depado/goploader/releases/clients/
source: clients/*
secrets:
- source: deploy_key
target: scp_key
when:
matrix:
TAG: 1.9
ARCH: amd64