-
Notifications
You must be signed in to change notification settings - Fork 2
/
.drone.script
105 lines (92 loc) · 3.22 KB
/
.drone.script
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
def main():
return [
pipeline()
]
def minify_pack():
return {
'name': 'minify_pack',
'image': 'patwie/dms-release:latest',
'commands': [
'rm -rf static.min',
'mkdir static.min',
'mkdir static.min/fonts',
'mkdir static.min/css',
'mkdir static.min/js',
'minify -o static.min/css/min.css static/css/main.css static/css/all.min.css',
'minify -o static.min/index.html static/index.html',
# 'minify -o static.min/js/jquery-3.4.1.min.js static/js/jquery-3.4.1.min.js',
# 'minify -o static.min/js/pdf.min.js static/js/pdf.js',
# 'minify -o static.min/js/pdf-worker.min.js static/js/pdf-worker.js',
# 'minify -o static.min/js/fuzzysort.min.js static/js/fuzzysort.js',
# 'minify -o static.min/js/main.min.js static/js/main.js',
'minify -o static.min/js/jquery-3.4.1.min.js static/js/jquery-3.4.1.min.js',
'minify -o static.min/js/pdf.min.js static/js/pdf.js static/js/pdf.worker.js',
'minify -o static.min/js/main.min.js static/js/fuzzysort.js static/js/main.js',
'minify -o static.min/js/dropzone.min.js static/js/dropzone.js',
'cp static/fonts/* static.min/fonts/',
'cp static/favicon.ico static.min/favicon.ico',
'/go/bin/packr2',
]
}
def build_step(os, arch):
commands = [
'dir',
'go build'
]
if os == 'windows':
commands = commands + \
['mv digitalmusicstand.exe digitalmusicstand-' + os + '-' + arch + '.exe']
else:
commands = commands + \
['mv digitalmusicstand digitalmusicstand-' + os + '-' + arch]
return {
'name': 'build-' + os + '-' + arch,
'image': 'golang:1.13',
'commands': commands,
'environment': {
'GOOS': os,
'GOARCH': arch,
}
}
def create_release():
return {
'name': 'create_release',
'image': 'patwie/tar:latest',
'commands': [
'zip -rv digitalmusicstand-windows-amd64.zip README.md digitalmusicstand-windows-amd64.exe',
'tar -czvf digitalmusicstand-linux-amd64.tar.gz README.md digitalmusicstand-linux-amd64',
'tar -czvf digitalmusicstand-linux-arm.tar.gz README.md digitalmusicstand-linux-arm',
'tar -czvf digitalmusicstand-linux-arm64.tar.gz README.md digitalmusicstand-linux-arm64'
],
}
def upload_release():
return {
'name': 'upload_release',
'image': 'plugins/github-release',
'settings': {
'api_key': {'from_secret': 'github_token'},
'files': [
'digitalmusicstand-windows-amd64.zip',
'digitalmusicstand-linux-amd64.tar.gz',
'digitalmusicstand-linux-arm64.tar.gz',
'digitalmusicstand-linux-arm.tar.gz',
],
'checksum': ['md5', 'sha256'],
},
'when': {'event': 'tag'}
}
def pipeline():
return {
'kind': 'pipeline',
'type': 'docker',
'name': 'linux',
'steps': [
minify_pack(),
build_step('linux', 'amd64'),
build_step('linux', 'arm64'),
build_step('linux', 'arm'),
build_step('windows', 'amd64'),
create_release(),
upload_release()
]
}