Skip to content

Commit

Permalink
Update release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
krsna-m authored and knative-prow-robot committed Nov 2, 2023
1 parent c9a580f commit c07d6f9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,18 @@ function publish_artifacts() {

# Sets the github release with the highest semver to 'latest'
function set_latest_to_highest_semver() {
# List latest release
local releases # don't combine with the line below, or $? will be 0
# Support tags in two formats
# - knative-v1.0.0
# - v1.0.0
releases="$(hub_tool -p release | cut -d '-' -f2)"
local last_version # don't combine with the line below, or $? will be 0
last_version="$(hub_tool -p release | cut -d'-' -f2 | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$'| sort -r -V | head -1)"
if ! [[ $? -eq 0 ]]; then
abort "cannot list releases"
fi
local last_version="$(echo "${releases}" | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$' | sort -r -V | head -1)"

local release_id # don't combine with the line below, or $? will be 0
release_id="$(hub_tool api /repos/${ORG_NAME}/${REPO_NAME}/releases/tags/knative-${last_version} | jq .id)"
if [[ $? -ne 0 ]]; then
abort "cannot get relase id from github"
fi

hub_tool api --method PATCH /repos/knative/serving/releases/$release_id -F make_latest=true > /dev/null || abort "error settomg $last_version to 'latest'"
echo "Github release ${last_version} set as 'latest'"
}
Expand Down

0 comments on commit c07d6f9

Please sign in to comment.