Skip to content

Commit

Permalink
fix: retrive only the last "next" draft release id (jenkins-infra#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve authored and lemeurherveCB committed Jun 1, 2022
1 parent b69aed8 commit 06b983d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vars/buildDockerAndPublishImage.groovy
Expand Up @@ -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 \'.[] | select(.draft == true and .name == "next") | .id\'').trim()
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()
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
Expand Down

0 comments on commit 06b983d

Please sign in to comment.