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:
Jakub Sokołowski 2021-04-15 11:20:31 +02:00 committed by Iuri Matias
parent e63db9a21c
commit 655097e2a2
5 changed files with 29 additions and 5 deletions

View File

@ -1 +1 @@
beta.8
0.1.0-beta.9

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.11'
library 'status-jenkins-lib@v1.2.12'
pipeline {
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 {
stage('Build') {
parallel {
@ -59,5 +67,21 @@ pipeline {
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
}

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.11'
library 'status-jenkins-lib@v1.2.12'
pipeline {
agent {

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.11'
library 'status-jenkins-lib@v1.2.12'
pipeline {
agent {

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.11'
library 'status-jenkins-lib@v1.2.12'
pipeline {
agent { label 'windows' }