Skip to content

Commit b383b34

Browse files
committed
add drone config to create artifact for release
1 parent ee4bf23 commit b383b34

File tree

1 file changed

+96
-2
lines changed

1 file changed

+96
-2
lines changed

.drone.star

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ OC_CI_BUILDIFIER = "owncloudci/bazel-buildifier:latest"
33
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:5.0"
44
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
55
OCIS_IMAGE = "owncloud/ocis:5.0"
6+
PLUGINS_GITHUB_RELEASE = "plugins/github-release"
7+
OC_CI_ALPINE = "owncloudci/alpine:latest"
68

79
dir = {
810
"webConfig": "/drone/src/tests/drone/web.config.json",
@@ -12,7 +14,8 @@ def main(ctx):
1214
return checkStarlark() + \
1315
pnpmlint(ctx) + \
1416
unitTestPipeline(ctx) + \
15-
e2eTests()
17+
e2eTests() + \
18+
releaseArtifacts(ctx)
1619

1720
def checkStarlark():
1821
return [{
@@ -139,7 +142,7 @@ def serveExtension():
139142
"image": OC_CI_NODEJS,
140143
"detach": True,
141144
"commands": [
142-
"pnpm build:w",
145+
"pnpm build",
143146
],
144147
},
145148
]
@@ -221,3 +224,94 @@ def ocisService():
221224
],
222225
},
223226
]
227+
228+
def releaseArtifacts(ctx):
229+
return [{
230+
"kind": "pipeline",
231+
"type": "docker",
232+
"name": "create-artifacts",
233+
"steps": installPnpm() +
234+
serveExtension() +
235+
[
236+
# {
237+
# "name": "check-dist",
238+
# "image": OC_CI_ALPINE,
239+
# "commands": [
240+
# "pwd",
241+
# "ls -l",
242+
# "cd dist",
243+
# "ls -l",
244+
# "pwd",
245+
# ],
246+
# },
247+
# {
248+
# "name": "zip-artifacts",
249+
# "image": OC_CI_ALPINE,
250+
# "commands": [
251+
# # "cd /drone/src/dist && zip -r ../dicomviewer-viewer-${DRONE_TAG}.zip .",
252+
# "md5sum dicomviewer-${DRONE_TAG}.zip > md5sum.txt",
253+
# "sha256sum dicomviewer-${DRONE_TAG}.zip > sha256sum.txt",
254+
# ],
255+
# },
256+
{
257+
"name": "publish",
258+
"image": PLUGINS_GITHUB_RELEASE,
259+
"settings": {
260+
"checksum": "sha256",
261+
"file_exists": "overwrite",
262+
"files": [
263+
# "dicomviewer-${DRONE_TAG}.zip",
264+
"dist/%s.tar.gz" % ctx.repo.name,
265+
# "md5sum.txt",
266+
# "sha256sum.txt",
267+
],
268+
},
269+
"environment": {
270+
"GITHUB_TOKEN": {
271+
"from_secret": "github_token",
272+
},
273+
},
274+
"when": {
275+
"event": [
276+
"tag",
277+
],
278+
},
279+
},
280+
],
281+
"trigger": {
282+
"ref": [
283+
"refs/tags/**",
284+
"refs/pull/**", # remove this
285+
],
286+
},
287+
}]
288+
289+
# def build(ctx):
290+
# result = {
291+
# "kind": "pipeline",
292+
# "type": "docker",
293+
# "name": "build",
294+
# "steps": [
295+
# {
296+
# "name": "github_release",
297+
# "image": PLUGINS_GITHUB_RELEASE,
298+
# "settings": {
299+
# "checksum": "sha256",
300+
# "file_exists": "overwrite",
301+
# "files": "build/dist/%s.tar.gz" % ctx.repo.name,
302+
# "prerelease": True,
303+
# },
304+
# "environment": {
305+
# "GITHUB_TOKEN": {
306+
# "from_secret": "github_token",
307+
# },
308+
# },
309+
# "when": {
310+
# "event": [
311+
# "tag",
312+
# "pull_request",
313+
# ],
314+
# },
315+
# },
316+
# ],
317+
# }

0 commit comments

Comments
 (0)