add starlark drone config
This commit is contained in:
parent
ffd84577a2
commit
649665154b
104
.drone.star
Normal file
104
.drone.star
Normal file
@ -0,0 +1,104 @@
|
||||
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')])
|
||||
]
|
150
.drone.yml
150
.drone.yml
@ -1,75 +1,91 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: default
|
||||
name: build
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: xoxys/rpmbuild
|
||||
pull: always
|
||||
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
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- name: build
|
||||
image: xoxys/rpmbuild
|
||||
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"
|
||||
environment:
|
||||
CUPSRELEASE: "${DRONE_TAG##v}"
|
||||
|
||||
- name: checksum
|
||||
image: alpine
|
||||
pull: always
|
||||
commands:
|
||||
- apk add --no-cache coreutils
|
||||
- sha256sum -b rpms/x86_64/* > sha256sum.txt
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- name: checksum
|
||||
image: alpine
|
||||
commands:
|
||||
- apk add --no-cache coreutils
|
||||
- "sha256sum -b rpms/x86_64/* > sha256sum.txt"
|
||||
|
||||
- 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:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- name: gpgsign
|
||||
pull: always
|
||||
image: plugins/gpgsign:1
|
||||
settings:
|
||||
detach_sign: true
|
||||
files:
|
||||
- "rpms/x86_64/*"
|
||||
key:
|
||||
from_secret: gpgsign_key
|
||||
passphrase:
|
||||
from_secret: gpgsign_passphrase
|
||||
when:
|
||||
ref:
|
||||
exclude:
|
||||
- "refs/pull/**"
|
||||
|
||||
- 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:
|
||||
event:
|
||||
- tag
|
||||
- name: publish
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://gitea.rknet.org
|
||||
files:
|
||||
- "rpms/x86_64/*"
|
||||
- sha256sum.txt
|
||||
title: "${DRONE_TAG}"
|
||||
when:
|
||||
ref:
|
||||
- "refs/tags/**"
|
||||
|
||||
- name: notify
|
||||
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
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
---
|
||||
kind: pipeline
|
||||
name: notifications
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: matrix
|
||||
image: plugins/matrix
|
||||
settings:
|
||||
homeserver: https://matrix.rknet.org
|
||||
password:
|
||||
from_secret: matrix_password
|
||||
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
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 1ded387fbbaa7f8c65b0d80499e0c3bac52839f76e8a5530a5ca2ffd3032c02a
|
||||
|
||||
...
|
||||
|
Reference in New Issue
Block a user