105 lines
2.8 KiB
Plaintext
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')])
|
|
]
|