Skip to content

Commit 285396b

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

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

.drone.star

+59-1
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,58 @@ def ocisService():
221224
],
222225
},
223226
]
227+
228+
def releaseArtifacts():
229+
return [{
230+
"kind": "pipeline",
231+
"type": "docker",
232+
"name": "create-artifacts",
233+
"depends_on": ["e2e-tests"],
234+
"steps": installPnpm() +
235+
[
236+
{
237+
"name": "pnpm-build",
238+
"image": OC_CI_NODEJS,
239+
"commands": [
240+
"pnpm build",
241+
],
242+
},
243+
{
244+
"name": "check-dist",
245+
"image": OC_CI_ALPINE,
246+
"commands": [
247+
"ls -la dist",
248+
],
249+
},
250+
{
251+
"name": "zip-artifacts",
252+
"image": OC_CI_ALPINE,
253+
"commands": [
254+
"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",
255+
"md5sum dicomviewer-${DRONE_TAG}.zip > md5sum.txt",
256+
"sha256sum dicomviewer-${DRONE_TAG}.zip > sha256sum.txt",
257+
],
258+
},
259+
{
260+
"name": "publish",
261+
"image": PLUGINS_GITHUB_RELEASE,
262+
"settings": {
263+
"api_key": {
264+
"from_secret": "GITHUB_TOKEN",
265+
},
266+
"files": [
267+
"dicomviewer-${DRONE_TAG}.zip",
268+
"md5sum.txt",
269+
"sha256sum.txt",
270+
],
271+
"overwrite": True,
272+
},
273+
},
274+
],
275+
"trigger": {
276+
"ref": [
277+
"refs/tags/**",
278+
"refs/pull/**", # remove this
279+
],
280+
},
281+
}]

0 commit comments

Comments
 (0)