This repository has been archived on 2024-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
cups/.drone.star
Robert Kaussow 649665154b
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
add starlark drone config
2019-08-20 12:19:46 +02:00

105 lines
2.8 KiB
Plaintext

def pipeline_build():
step_build = {
'image': 'xoxys/rpmbuild',
'name': 'build',
'environment': {
'CUPSRELEASE': '${DRONE_TAG##v}'
},
'commands': [
'[ -z "$CUPSRELEASE" ] && CUPSRELEASE=2.2.10',
'wget https://github.com/apple/cups/releases/download/v$CUPSRELEASE/cups-$CUPSRELEASE-source.tar.gz',
'mkdir ./rpms',
'rpmbuild -ta --define "_rpmdir $(pwd)/rpms" --without libusb1 cups-$CUPSRELEASE-source.tar.gz'
]
}
step_checksum = {
'name': 'checksum',
'image': 'alpine',
'commands': [
'apk add --no-cache coreutils',
'sha256sum -b rpms/x86_64/* > sha256sum.txt'
]
}
step_sign = {
'name': 'gpgsign',
'image': 'plugins/gpgsign:1',
'pull': 'always',
'settings': {
'key': { 'from_secret': 'gpgsign_key' },
'passphrase': { 'from_secret': 'gpgsign_passphrase' },
'detach_sign': True,
'files': [
'rpms/x86_64/*'
]
},
'when': {
'ref': {
'exclude': ['refs/pull/**'],
},
},
}
step_publish = {
'name': 'publish',
'image': 'plugins/gitea-release',
'settings': {
'base_url': 'https://gitea.rknet.org',
'api_key': { 'from_secret': 'gitea_token' },
'files': [
'rpms/x86_64/*',
'sha256sum.txt'
],
'title': '${DRONE_TAG}'
},
'when': {
'ref': ['refs/tags/**'],
}
}
return {
'kind': 'pipeline',
'name': 'build',
'steps': [
step_build,
step_checksum,
step_sign,
step_publish
]
}
def pipeline_notify(deps=[]):
step_matrix = {
'name': 'matrix',
'image': 'plugins/matrix',
'settings': {
'homeserver': 'https://matrix.rknet.org',
'roomid': 'MtidqQXWWAtQcByBhH:rknet.org',
'template': 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
'username': { 'from_secret': 'matrix_username' },
'password': { 'from_secret': 'matrix_password' },
}
}
return {
'kind': 'pipeline',
'name': 'notifications',
'steps': [
step_matrix,
],
'depends_on': deps,
'trigger': {
'ref': ['refs/heads/master', 'refs/tags/**'],
'status': [ 'success', 'failure' ],
},
}
def main():
return [
pipeline_build(),
pipeline_notify(deps=[pipeline_build().get('name')])
]