Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.11] 🐛 Set latest release only when publishing to Github #347

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -658,13 +658,18 @@ function publish_artifacts() {

# Sets the github release with the highest semver to 'latest'
function set_latest_to_highest_semver() {
local last_version # don't combine with the line below, or $? will be 0
if ! (( PUBLISH_TO_GITHUB )); then
return 0
fi
echo "Setting latest release to highest semver"

local last_version release_id # don't combine with assignment else $? 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 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"
Expand Down Expand Up @@ -701,6 +706,8 @@ function main() {
function_exists build_release || abort "function 'build_release()' not defined"
[[ -x ${VALIDATION_TESTS} ]] || abort "test script '${VALIDATION_TESTS}' doesn't exist"

banner "Environment variables"
env
# Log what will be done and where.
banner "Release configuration"
if which gcloud &>/dev/null ; then
Expand Down