From a3c05e9bc97b0c8d5425ea123487fb7f2930cf94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= <91831478+lemeurherve@users.noreply.github.com> Date: Mon, 16 May 2022 18:41:30 +0200 Subject: [PATCH] fix: correct jq expression to retrieve last `next` release draft Follow-up of #380 The previous one was retrieving the last release #, not always in draft nor titled "next" --- vars/buildDockerAndPublishImage.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/buildDockerAndPublishImage.groovy b/vars/buildDockerAndPublishImage.groovy index 362f1074e..b4a00e538 100644 --- a/vars/buildDockerAndPublishImage.groovy +++ b/vars/buildDockerAndPublishImage.groovy @@ -196,7 +196,7 @@ def call(String imageName, Map userConfig=[:]) { fi ''' - final String release = sh(returnStdout: true, script: 'gh api ${GH_RELEASES_API_URI} | jq -e -r \'. | max_by(.id) | select(.draft == true and .name == "next").id\'').trim() + final String release = sh(returnStdout: true, script: 'gh api ${GH_RELEASES_API_URI} | jq -e -r \'[ .[] | select(.draft == true and .name == "next").id] | max\'').trim() withEnv(["GH_NEXT_RELEASE_URI=${ghReleasesApiUri}/${release}"]) { sh 'gh api -X PATCH -F draft=false -F name="${TAG_NAME}" -F tag_name="${TAG_NAME}" "${GH_NEXT_RELEASE_URI}"' } // withEnv