Add pipeline for releasing from tag
Some checks failed
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2022-11-02 15:40:29 +13:00
parent 50f0da12d8
commit c85320a15c

View File

@@ -64,6 +64,24 @@ local gen_pipeline(distro) =
}, },
}; };
local gen_release() =
{kind: 'pipeline',
type: 'docker',
name: 'Generate Release'
commands: [
'sleep 10', // give docker enough time to start
'mkdir ${DRONE_REPO_NAME}',
'rsync -a . ${DRONE_REPO_NAME} --exclude ${DRONE_REPO_NAME}',
'cd ${DRONE_REPO_NAME}',
'tar -czf ../${DRONE_REPO_NAME}.${DRONE_TAG}.tar.gz ./*', // Create an archive of the role
'curl --user ${GITEA_USER}:${GITEA_TOKEN} --upload-file ../${DRONE_REPO_NAME}.${DRONE_TAG}.tar.gz \
https://${GITEA_URL}/api/packages/${GITEA_REPOUSER}/generic/ansible-role-common/${DRONE_TAG}/${DRONE_REPO_NAME}.${DRONE_TAG}.tar.gz',
],
when:
{ event: {include: ['tag']},
},
},
// Generate the output // Generate the output
[ [
gen_pipeline('centos7'), gen_pipeline('centos7'),
@@ -72,10 +90,12 @@ local gen_pipeline(distro) =
gen_pipeline('debian11'), gen_pipeline('debian11'),
{kind: 'pipeline', {kind: 'pipeline',
type: 'docker', type: 'docker',
name: 'Notify', name: 'Notify normal',
steps: [email_notification()], steps: [email_notification()],
when: when:
{ status: [ 'success', 'failure' ] }, { status: [ 'success', 'failure' ] ,
event: {exclude: ['tag']},
},
depends_on: depends_on:
['Test on %(distro)s' % { distro: distro } ['Test on %(distro)s' % { distro: distro }
for distro in distros] for distro in distros]