Skip to content

Commit 45b0383

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

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

.drone.star

Lines changed: 52 additions & 1 deletion
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()
1619

1720
def checkStarlark():
1821
return [{
@@ -221,3 +224,51 @@ def ocisService():
221224
],
222225
},
223226
]
227+
228+
def releaseArtifacts():
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+
"ls -la dist",
241+
],
242+
},
243+
{
244+
"name": "zip-artifacts",
245+
"image": OC_CI_ALPINE,
246+
"commands": [
247+
"if [ -d 'dist' ] && [ \"$(ls -A dist)\" ]; then cd dist && zip -r ../dicomviewer-viewer-${DRONE_TAG}.zip .; else echo 'Dist folder is empty or does not exist'; exit 1; fi",
248+
"md5sum dicomviewer-${DRONE_TAG}.zip > md5sum.txt",
249+
"sha256sum dicomviewer-${DRONE_TAG}.zip > sha256sum.txt",
250+
],
251+
},
252+
{
253+
"name": "publish",
254+
"image": PLUGINS_GITHUB_RELEASE,
255+
"settings": {
256+
"api_key": {
257+
"from_secret": "GITHUB_TOKEN",
258+
},
259+
"files": [
260+
"dicomviewer-${DRONE_TAG}.zip",
261+
"md5sum.txt",
262+
"sha256sum.txt",
263+
],
264+
"overwrite": True,
265+
},
266+
},
267+
],
268+
"trigger": {
269+
"ref": [
270+
"refs/tags/**",
271+
"refs/pull/**", # remove this
272+
],
273+
},
274+
}]

0 commit comments

Comments
 (0)