ci: add ability to create draft GitHub releases
This adds a `Publish` stage to the combined `Jenkinsfile` which when the `PUBLISH` parameters is true pushes a __draft__ release to GitHub. The job remembers the last value of `PUBLISH` parameter selected. The release uses the contents of the `VERSION` file at the root of the repo as the name for the release, and leaves the contents to be filled in by whoever will approve the release. The automation overwrites - or to be exact, deletes and recreates - the release, so releated builds for the same release will simply re-create it. All the built artifacts are included in the release. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
e63db9a21c
commit
655097e2a2
|
@ -1,4 +1,4 @@
|
||||||
library 'status-react-jenkins@v1.2.11'
|
library 'status-jenkins-lib@v1.2.12'
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'linux' }
|
agent { label 'linux' }
|
||||||
|
@ -16,6 +16,14 @@ pipeline {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
booleanParam(
|
||||||
|
name: 'PUBLISH',
|
||||||
|
description: 'Trigger publishing of build results to GitHub.',
|
||||||
|
defaultValue: getPublishDefault(params.PUBLISH),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
parallel {
|
parallel {
|
||||||
|
@ -59,5 +67,21 @@ pipeline {
|
||||||
jenkins.setBuildDesc(urls)
|
jenkins.setBuildDesc(urls)
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
stage('Publish') {
|
||||||
|
when { expression { params.PUBLISH } }
|
||||||
|
steps { script {
|
||||||
|
github.publishReleaseFiles(repo: 'status-desktop');
|
||||||
|
} }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Helper that makes PUBLISH default to 'false' unless:
|
||||||
|
* - The build is for a release branch
|
||||||
|
* - A user explicitly specified a value
|
||||||
|
* Since release builds create and re-create GitHub drafts every time. */
|
||||||
|
def Boolean getPublishDefault(Boolean previousValue) {
|
||||||
|
if (env.JOB_NAME.startsWith('status-desktop/release')) { return true }
|
||||||
|
if (previousValue != null) { return previousValue }
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
library 'status-react-jenkins@v1.2.11'
|
library 'status-jenkins-lib@v1.2.12'
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
library 'status-react-jenkins@v1.2.11'
|
library 'status-jenkins-lib@v1.2.12'
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
library 'status-react-jenkins@v1.2.11'
|
library 'status-jenkins-lib@v1.2.12'
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'windows' }
|
agent { label 'windows' }
|
||||||
|
|
Loading…
Reference in New Issue