From f0d79f3af082b4c98628d3380eaf3e987d1731f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 17 Feb 2021 15:16:27 +0100 Subject: [PATCH] ci: adjust behavior of PUBLISH to be true for releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ci/Jenkinsfile.combined | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 736dbc71ca..26cdb4a00a 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -26,7 +26,7 @@ pipeline { booleanParam( name: 'PUBLISH', 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) 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 +}