-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.drone.yml
250 lines (244 loc) · 7.42 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
---
kind: pipeline
type: docker
name: default
workspace:
path: /drone/src
volumes:
- name: cache
temp: { }
environment:
GOCACHE: /cache/go/build
GOMODCACHE: /cache/go/download
GOPRIVATE: github.com/forestvpn/goauthlib
steps:
- name: deps
image: golang:1.20.2
volumes:
- name: cache
path: /cache
environment:
GITHUB_TOKEN:
from_secret: GITHUB_TOKEN
commands:
- utils/ci_setup.sh
- apt update
- apt install git -y
- cd src
- go get -t -d -v ./...
- go build all
- name: fetch
image: docker:git
commands:
- git fetch --tags
- name: test
image: golang:1.20.2
volumes:
- name: cache
path: /cache
depends_on:
- deps
commands:
- apt update
- apt install build-essential -y
- cd src
- go test ./...
# - name: build-linux-arm64
# image: golang:1.20.2
# #chocolatey/choco:latest-linux
# environment:
# # GITHUB_TOKEN:
# # from_secret: GITHUB_TOKEN
# GOOS: linux
# GOARCH: arm64
# privileged: false
# volumes:
# - name: cache
# path: /cache
# commands:
# - cd src
# - go build -ldflags="-w -s -X main.appVersion={{.Env.VERSION}}" -gcflags="-l -B -wb=false" -o ../fvpn
# depends_on:
# - test
# when:
# ref:
# include:
# - refs/tags/v*.*.*
# - refs/tags/v*.*.*-post*
# - refs/tags/v*.*.*-beta*
# - name: build-ipkg-arm64
# image: debian
# depends_on:
# - build-linux-arm64
# commands:
# - apt update
# - apt install binutils -y
# - mkdir -p ipkg/fvpn/control
# - mkdir ipkg/fvpn/data
# - export CTRLF=ipkg/fvpn/control/control
# - "echo Package: fvpn > $CTRLF"
# - "echo Version: ${DRONE_TAG} >> $CTRLF"
# - "echo Architecture: arm64 >> $CTRLF"
# - "echo Maintainer: [email protected] >> $CTRLF"
# - "echo Description: ForestVPN - Fast, secure, and modern VPN. >> $CTRLF"
# - "echo Priority: optional >> $CTRLF"
# - "echo Depends: wireguard >> $CTRLF"
# - echo 2.0 > ipkg/fvpn/debian-binary
# - export PREINST=ipkg/fvpn/control/preinst
# - echo "#!/bin/bash" > $PREINST
# - echo arch=`uname -m` > $PREINST
# - echo "if [ $arch -ne 'arm64' ]; then" >> $PREINST
# - echo " echo ${arch} is not supported" >> $PREINST
# - echo " exit 1" >> $PREINST
# - chmod +x $PREINST
# - export POSTINST=ipkg/fvpn/control/postinst
# - echo "#!/bin/bash" > $POSTINST
# - echo fvpn >> $POSTINST
# - echo "if [ $? -eq 0 ]; then" >> $POSTINST
# - echo " echo Successfully installed" >> $POSTINST
# - echo else >> $POSTINST
# - echo " echo Could not install >&2" >> $POSTINST
# - chmod +x ipkg/fvpn/control/postinst
# - export BIN_DIR=ipkg/fvpn/data/usr/local/bin/
# - mkdir -p $BIN_DIR
# - cp fvpn $BIN_DIR
# - >
# bash -s <<SCRIPT
# pushd ipkg/fvpn/control/
# tar --numeric-owner --group=0 --owner=0 -czf ../control.tar.gz ./*
# popd
# pushd ipkg/fvpn/data
# tar --numeric-owner --group=0 --owner=0 -czf ../data.tar.gz ./*
# popd
# pushd ipkg/fvpn
# tar --numeric-owner --group=0 --owner=0 -cf ../../fvpn_${DRONE_TAG}_arm64.ipk ./debian-binary ./data.tar.gz ./control.tar.gz
# popd
# SCRIPT
# - rm fvpn
# - rm -rf ipkg
# - name: build-linux-mips
# image: golang:1.18.4
# environment:
# GOOS: linux
# GOARCH: mips
# privileged: false
# volumes:
# - name: cache
# path: /cache
# commands:
# - cd src
# - go build -ldflags="-w -s -X main.appVersion={{.Env.VERSION}}" -gcflags="-l -B -wb=false" -o ../fvpn
# depends_on:
# - build-ipkg-arm64
# - name: build-ipkg-mips
# image: debian
# depends_on:
# - build-linux-mips
# commands:
# - apt update
# - apt install binutils -y
# - mkdir -p ipkg/fvpn/control
# - mkdir ipkg/fvpn/data
# - export CTRLF=ipkg/fvpn/control/control
# - "echo Package: fvpn > $CTRLF"
# - "echo Version: ${DRONE_TAG} >> $CTRLF"
# - "echo Architecture: mips >> $CTRLF"
# - "echo Maintainer: [email protected] >> $CTRLF"
# - "echo Description: ForestVPN - Fast, secure, and modern VPN. >> $CTRLF"
# - "echo Priority: optional >> $CTRLF"
# - "echo Depends: wireguard >> $CTRLF"
# - echo 2.0 > ipkg/fvpn/debian-binary
# - export PREINST=ipkg/fvpn/control/preinst
# - echo "#!/bin/bash" > $PREINST
# - echo arch=`uname -m` > $PREINST
# - echo "if [ $arch -ne 'mips' ]; then" >> $PREINST
# - echo " echo ${arch} is not supported" >> $PREINST
# - echo " exit 1" >> $PREINST
# - chmod +x $PREINST
# - export POSTINST=ipkg/fvpn/control/postinst
# - echo "#!/bin/bash" > $POSTINST
# - echo fvpn >> $POSTINST
# - echo "if [ $? -eq 0 ]; then" >> $POSTINST
# - echo " echo Successfully installed" >> $POSTINST
# - echo else >> $POSTINST
# - echo " echo Could not install >&2" >> $POSTINST
# - chmod +x ipkg/fvpn/control/postinst
# - export BIN_DIR=ipkg/fvpn/data/usr/local/bin/
# - mkdir -p $BIN_DIR
# - cp fvpn $BIN_DIR
# - >
# bash -s <<SCRIPT
# pushd ipkg/fvpn/control/
# tar --numeric-owner --group=0 --owner=0 -czf ../control.tar.gz ./*
# popd
# pushd ipkg/fvpn/data
# tar --numeric-owner --group=0 --owner=0 -czf ../data.tar.gz ./*
# popd
# pushd ipkg/fvpn
# tar --numeric-owner --group=0 --owner=0 -cf ../../fvpn_${DRONE_TAG}_mips.ipk ./debian-binary ./data.tar.gz ./control.tar.gz
# popd
# SCRIPT
# - rm fvpn
# - rm -rf ipkg
- name: release
image: chocolatey/choco:latest-linux
environment:
GITHUB_TOKEN:
from_secret: GITHUB_TOKEN
CHOCOLATEY_API_KEY:
from_secret: CHOCOLATEY_API_KEY
GOPATH: /usr/local/go
privileged: false
volumes:
- name: cache
path: /cache
commands:
- apt update
- apt install git wget -y
- wget -q https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
- tar -xf go1.20.2.linux-amd64.tar.gz
- rm go1.20.2.linux-amd64.tar.gz
- chown -R root:root go
- mv go /usr/local/
- export PATH=$PATH:$GOPATH/bin
- export VERSION=${DRONE_TAG}
- go install github.com/goreleaser/goreleaser@latest
- cd src
- goreleaser release -f ../.goreleaser-stable.yaml
depends_on:
- test
when:
ref:
include:
- refs/tags/v*.*.*
- refs/tags/v*.*.*-post*
exclude:
- refs/tags/v*.*.*-beta*
- name: beta-release
image: golang:1.20.2-bullseye
environment:
GITHUB_TOKEN:
from_secret: GITHUB_TOKEN
CHOCOLATEY_API_KEY:
from_secret: CHOCOLATEY_API_KEY
privileged: false
volumes:
- name: cache
path: /cache
commands:
- export VERSION=${DRONE_TAG}
- apt update
- apt install git binutils -y
- go install github.com/goreleaser/goreleaser@latest
- cd packages
- build.sh
- cd ../src
- goreleaser release -f ../.goreleaser-beta.yaml
depends_on:
- test
when:
ref:
- refs/tags/v*.*.*-beta*
trigger:
event:
- tag