Skip to content

Commit

Permalink
add drone config to create artifact for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung committed Sep 23, 2024
1 parent ee4bf23 commit d2991f2
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ OC_CI_BUILDIFIER = "owncloudci/bazel-buildifier:latest"
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:5.0"
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
OCIS_IMAGE = "owncloud/ocis:5.0"
PLUGINS_GITHUB_RELEASE = "plugins/github-release"
OC_CI_ALPINE = "owncloudci/alpine:latest"

dir = {
"webConfig": "/drone/src/tests/drone/web.config.json",
Expand All @@ -12,7 +14,8 @@ def main(ctx):
return checkStarlark() + \
pnpmlint(ctx) + \
unitTestPipeline(ctx) + \
e2eTests()
e2eTests() + \
releaseArtifacts()

def checkStarlark():
return [{
Expand Down Expand Up @@ -221,3 +224,58 @@ def ocisService():
],
},
]

def releaseArtifacts():
return [{
"kind": "pipeline",
"type": "docker",
"name": "create-artifacts",
"depends_on": ["e2e-tests"],
"steps": [
{
"name": "pnpm-build",
"image": OC_CI_NODEJS,
"commands": [
"pnpm install",
"pnpm build:w",
],
},
{
"name": "check-dist",
"image": OC_CI_ALPINE,
"commands": [
"ls -la dist",
],
},
{
"name": "zip-artifacts",
"image": OC_CI_ALPINE,
"commands": [
"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",
"md5sum dicomviewer-${DRONE_TAG}.zip > md5sum.txt",
"sha256sum dicomviewer-${DRONE_TAG}.zip > sha256sum.txt",
],
},
{
"name": "publish",
"image": PLUGINS_GITHUB_RELEASE,
"settings": {
"api_key": {
"from_secret": "GITHUB_TOKEN",
},
"files": [
"dicomviewer-${DRONE_TAG}.zip",
"md5sum.txt",
"sha256sum.txt",
],
"overwrite": True,
},
},
],
"trigger": {
"ref": [
"refs/tags/**",
"refs/pull/**", # remove this
],
},
}]

0 comments on commit d2991f2

Please sign in to comment.