-
Notifications
You must be signed in to change notification settings - Fork 41
/
.drone.yml
150 lines (137 loc) · 3.59 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
138
139
140
141
142
143
144
145
146
147
148
149
150
workspace:
base: /go
path: src/github.com/Depado/goploader/
matrix:
ARCH:
- arm
- amd64
pipeline:
# Ensure dep and rice commands are installed, and use dep for vendoring
prerequisites:
image: "golang:1.10"
commands:
- go get -u github.com/golang/dep/cmd/dep
- go get github.com/GeertJohan/go.rice/rice
- dep ensure
# Build the server
server:
image: "golang:1.10"
group: build
commands:
- go build -o server/server ./server
environment:
- GOARCH=${ARCH}
- CGO_ENABLED=0
# Build client
client:
image: "golang:1.10"
group: build
commands:
- go build -o client/client ./client
environment:
- GOARCH=${ARCH}
- CGO_ENABLED=0
# Build docs
docs:
image: python:3
group: build
commands:
- cd docs
- pip install -r requirements.txt
- mkdocs build
# Release only for the latest stable version of Go
server-release:
image: "golang:1.10"
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:
event: deployment
# 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
event: deployment
# Build the deployable version (embedded assets, 1.9 version and arm arch)
server-deploy-build:
image: "golang:1.10"
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:
ARCH: arm
event: deployment
# 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:
ARCH: arm
event: deployment
# Executed only when deploying
client-release:
image: "golang:1.10"
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:
ARCH: amd64
event: deployment
# 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:
ARCH: amd64
event: deployment
github-release:
image: plugins/github-release
secrets: [ github_token ]
files:
- clients/*
when:
event: tag