-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.star
115 lines (107 loc) · 2.52 KB
/
.drone.star
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
repo = "spritsail/jackett"
architectures = ["amd64", "arm64"]
publish_branches = ["master"]
def main(ctx):
builds = []
depends_on = []
for arch in architectures:
key = "build-%s" % arch
builds.append(step(arch, key))
depends_on.append(key)
if ctx.build.branch in publish_branches:
builds.append(publish(depends_on))
builds.append(update_readme())
return builds
def step(arch, key):
return {
"kind": "pipeline",
"name": key,
"platform": {
"os": "linux",
"arch": arch,
},
"steps": [
{
"name": "build",
"pull": "always",
"image": "spritsail/docker-build",
},
{
"name": "test",
"pull": "always",
"image": "spritsail/docker-test",
"settings": {
"curl": ":9117",
"curl_opts": "-c /dev/null"
}
},
{
"name": "publish",
"pull": "always",
"image": "spritsail/docker-publish",
"settings": {
"registry": {"from_secret": "registry_url"},
"login": {"from_secret": "registry_login"},
},
"when": {
"branch": publish_branches,
"event": ["push"],
},
},
],
}
def publish(depends_on):
return {
"kind": "pipeline",
"name": "publish-manifest",
"depends_on": depends_on,
"platform": {
"os": "linux",
},
"steps": [
{
"name": "publish",
"image": "spritsail/docker-multiarch-publish",
"pull": "always",
"settings": {
"tags": [
"latest",
"%label io.spritsail.version.jackett | %auto"
],
"src_registry": {"from_secret": "registry_url"},
"src_login": {"from_secret": "registry_login"},
"dest_repo": repo,
"dest_login": {"from_secret": "docker_login"},
},
"when": {
"branch": publish_branches,
"event": ["push"],
},
},
],
}
def update_readme():
return {
"kind": "pipeline",
"name": "update-readme",
"depends_on": [
"publish-manifest",
],
"steps": [
{
"name": "dockerhub-readme",
"pull": "always",
"image": "jlesage/drone-push-readme",
"settings": {
"repo": repo,
"username": {"from_secret": "docker_username"},
"password": {"from_secret": "docker_password"},
},
"when": {
"branch": publish_branches,
"event": ["push"],
},
},
],
}
# vim: ft=python sw=2