ci: adjust behavior of PUBLISH to be true for releases

Otherwise release builds never create the GitHub draft releases.
Not unless a user explicitly stats a build with `PUBLISH: true`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-02-17 15:16:27 +01:00
parent 09ac3e6a9e
commit f0d79f3af0
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 11 additions and 1 deletions

View File

@ -26,7 +26,7 @@ pipeline {
booleanParam( booleanParam(
name: 'PUBLISH', name: 'PUBLISH',
description: 'Trigger publishing of build results for nightly or release.', description: 'Trigger publishing of build results for nightly or release.',
defaultValue: params.PUBLISH ?: false, defaultValue: getPublishDefault(params.PUBLISH),
) )
} }
@ -120,3 +120,13 @@ def List genChoices(String previousChoice, List defaultChoices) {
choices.add(0, previousChoice) choices.add(0, previousChoice)
return choices return choices
} }
/* 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-react/release')) { return true }
if (previousValue != null) { return previousValue }
return false
}