Skip to content

Commit

Permalink
fix: integer instead of string for release id
Browse files Browse the repository at this point in the history
Follow-up of #413
  • Loading branch information
lemeurherve committed Jun 13, 2022
1 parent 3f87a6d commit ef17c03
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions vars/buildDockerAndPublishImage.groovy
Expand Up @@ -236,14 +236,14 @@ def call(String imageName, Map userConfig=[:]) {
final String repository = origin.split('/')[4]
final String ghReleasesApiUri = "/repos/${org}/${repository}/releases"
withEnv(["GH_RELEASES_API_URI=${ghReleasesApiUri}"]) {
String release = ''
int releaseId = 0
if (isUnix()) {
release = sh(returnStdout: true, script: 'gh api ${GH_RELEASES_API_URI} | jq -e -r \'[ .[] | select(.draft == true and .name == "next").id] | max\' || echo \'\'').trim()
releaseId = sh(returnStdout: true, script: 'gh api ${GH_RELEASES_API_URI} | jq -e -r \'[ .[] | select(.draft == true and .name == "next").id] | max\' || echo 0').trim()
} else {
release = powershell(returnStdout: true, script: 'gh api $env:GH_RELEASES_API_URI | jq -e -r \'[ .[] | select(.draft == true and .name == "next").id] | max\' || echo \'\'').trim()
releaseId = powershell(returnStdout: true, script: 'gh api $env:GH_RELEASES_API_URI | jq -e -r \'[ .[] | select(.draft == true and .name == "next").id] | max\' || echo 0').trim()
}
if (release) {
withEnv(["GH_NEXT_RELEASE_URI=${ghReleasesApiUri}/${release}"]) {
if (releaseId > 0) {
withEnv(["GH_NEXT_RELEASE_URI=${ghReleasesApiUri}/${releaseId}"]) {
if (isUnix()) {
sh 'gh api -X PATCH -F draft=false -F name="${TAG_NAME}" -F tag_name="${TAG_NAME}" "${GH_NEXT_RELEASE_URI}"'
} else {
Expand Down

0 comments on commit ef17c03

Please sign in to comment.