-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bumping k8s.io/utils 18e509b...49e7df5: > 49e7df5 Merge pull request # 296 from skitt/deprecate-minmax > 702e33f Merge pull request # 317 from gibizer/revert-stdlib-slices > 3abbf95 Deprecate integer min/max functions > f90d014 Merge pull request # 315 from tklauser/deprecated-strings-slices > 8866f61 Revert "Deprecate strings/slices functions covered by stdlib slices" > 4965b0f Deprecate strings/slices functions covered by stdlib slices bumping knative.dev/pkg 0c2a238...c43477f: > c43477f upgrade to latest dependencies (# 3137) bumping k8s.io/kube-openapi 8e68654...9e1beec: > 9e1beec Merge pull request # 504 from pohly/naming-convention > f7e401e Merge pull request # 510 from Jefftree/downgrade-ginkgo > 5b13d40 names match: tighten validation of inlining and metadata > 65a50c7 Merge pull request # 509 from Jefftree/bump-gengo > 04edf7c Downgrade ginkgo to avoid introducing dependency of x/exp > 4fca853 names match: add unit tests demonstrating false positives > 76de80e Merge pull request # 508 from Jefftree/downgrade-dep > 21ea66f Upgrade gengo > 5732855 Merge pull request # 503 from Jefftree/patch-experiment-json-test > 909c8d5 Merge pull request # 507 from kubernetes/Jefftree-patch-2 > 0db3e15 downgrade govalidator, go-restful, jsonreference > 91dab69 Merge pull request # 500 from thockin/master > 24eb939 Update github actions to test for later go versions > d7e11f2 disable dependabot > cb93749 Bump gengo version > bd91a10 Patch go-json-experiment/json negative float test bumping knative.dev/operator 23a67de...fa1ac4d: > fa1ac4d Prepare the release of 1.17 (# 1967) > 1821cf7 Support specifying affinity in Helm chart (# 1962) > dfd068a upgrade to latest dependencies (# 1964) > b5b73d3 Removed the directory kodata for webhook (# 1963) > b9ab4f9 upgrade to latest dependencies (# 1960) > 316aa10 upgrade to latest dependencies (# 1958) bumping knative.dev/hack f8be0cc...c142b48: > c142b48 Refactor release script to gh CLI (# 408) Signed-off-by: Knative Automation <[email protected]>
- Loading branch information
1 parent
3e4bb0a
commit 6ec7101
Showing
5 changed files
with
57 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,11 +90,10 @@ export GOFLAGS="-ldflags=-s -ldflags=-w" | |
export GITHUB_TOKEN="" | ||
readonly IMAGES_REFS_FILE="${IMAGES_REFS_FILE:-$(mktemp -d)/images_refs.txt}" | ||
|
||
# Convenience function to run the hub tool. | ||
# Parameters: $1..$n - arguments to hub. | ||
function hub_tool() { | ||
# Pinned to SHA because of https://github.com/github/hub/issues/2517 | ||
go_run github.com/github/hub/v2@363513a "$@" | ||
# Convenience function to run the GitHub CLI tool `gh`. | ||
# Parameters: $1..$n - arguments to gh. | ||
function gh_tool() { | ||
go_run github.com/cli/cli/v2/cmd/[email protected] "$@" | ||
} | ||
|
||
# Shortcut to "git push" that handles authentication. | ||
|
@@ -193,7 +192,7 @@ function prepare_dot_release() { | |
# Support tags in two formats | ||
# - knative-v1.0.0 | ||
# - v1.0.0 | ||
releases="$(hub_tool release | cut -d '-' -f2)" | ||
releases="$(gh_tool release list --json tagName --jq '.[].tagName' | cut -d '-' -f2)" | ||
echo "Current releases are: ${releases}" | ||
[[ $? -eq 0 ]] || abort "cannot list releases" | ||
# If --release-branch passed, restrict to that release | ||
|
@@ -218,7 +217,7 @@ function prepare_dot_release() { | |
# Ensure there are new commits in the branch, otherwise we don't create a new release | ||
setup_branch | ||
# Use the original tag (ie. potentially with a knative- prefix) when determining the last version commit sha | ||
local github_tag="$(hub_tool release | grep "${last_version}")" | ||
local github_tag="$(gh_tool release list --json tagName --jq '.[].tagName' | grep "${last_version}")" | ||
local last_release_commit="$(git rev-list -n 1 "${github_tag}")" | ||
local last_release_commit_filtered="$(git rev-list --invert-grep --grep "\[skip-dot-release\]" -n 1 "${github_tag}")" | ||
local release_branch_commit="$(git rev-list -n 1 upstream/"${RELEASE_BRANCH}")" | ||
|
@@ -239,7 +238,7 @@ function prepare_dot_release() { | |
# If --release-notes not used, copy from the latest release | ||
if [[ -z "${RELEASE_NOTES}" ]]; then | ||
RELEASE_NOTES="$(mktemp)" | ||
hub_tool release show -f "%b" "${github_tag}" > "${RELEASE_NOTES}" | ||
gh_tool release view "${github_tag}" --json "body" --jq '.body' > "${RELEASE_NOTES}" | ||
echo "Release notes from ${last_version} copied to ${RELEASE_NOTES}" | ||
fi | ||
} | ||
|
@@ -640,18 +639,12 @@ function set_latest_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)" | ||
last_version="$(gh_tool release list --json tagName --jq '.[].tagName' | 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 | ||
|
||
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/${ORG_NAME}/${REPO_NAME}/releases/$release_id" \ | ||
-F make_latest=true > /dev/null || abort "error setting $last_version to 'latest'" | ||
|
||
gh_tool release edit "knative-${last_version}" --latest > /dev/null || abort "error setting $last_version to 'latest'" | ||
echo "Github release ${last_version} set as 'latest'" | ||
} | ||
|
||
|
@@ -742,12 +735,14 @@ function publish_to_github() { | |
local description="$(mktemp)" | ||
local attachments_dir="$(mktemp -d)" | ||
local commitish="" | ||
local target_branch="" | ||
local github_tag="knative-${TAG}" | ||
|
||
# Copy files to a separate dir | ||
# shellcheck disable=SC2068 | ||
for artifact in $@; do | ||
cp ${artifact} "${attachments_dir}"/ | ||
attachments+=("--attach=${artifact}#$(basename ${artifact})") | ||
attachments+=("${artifact}#$(basename ${artifact})") | ||
done | ||
echo -e "${title}\n" > "${description}" | ||
if [[ -n "${RELEASE_NOTES}" ]]; then | ||
|
@@ -774,13 +769,16 @@ function publish_to_github() { | |
git tag -a "${github_tag}" -m "${title}" | ||
git_push tag "${github_tag}" | ||
|
||
[[ -n "${RELEASE_BRANCH}" ]] && commitish="--commitish=${RELEASE_BRANCH}" | ||
[[ -n "${RELEASE_BRANCH}" ]] && target_branch="--target=${RELEASE_BRANCH}" | ||
for i in {2..0}; do | ||
hub_tool release create \ | ||
${attachments[@]} \ | ||
--file="${description}" \ | ||
"${commitish}" \ | ||
"${github_tag}" && return 0 | ||
# shellcheck disable=SC2068 | ||
gh_tool release create \ | ||
"${github_tag}" \ | ||
--title "${title}" \ | ||
--notes-file "${description}" \ | ||
"${target_branch}" \ | ||
${attachments[@]} && return 0 | ||
|
||
if [[ "${i}" -gt 0 ]]; then | ||
echo "Error publishing the release, retrying in 15s..." | ||
sleep 15 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters