Skip to content

Commit

Permalink
fix: correct jq expression to retrieve last next release draft
Browse files Browse the repository at this point in the history
Follow-up of #380 

The previous one was retrieving the last release #, not always in draft nor titled "next"
  • Loading branch information
lemeurherve committed May 16, 2022
1 parent 79f188c commit a3c05e9
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 \'. | 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
Expand Down

0 comments on commit a3c05e9

Please sign in to comment.