chore: update release script to use gh from binny (#3084)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Keith Zantow 2024-07-31 20:10:17 -04:00 committed by GitHub
parent 92d63df6f5
commit 05a10e8bed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,12 +4,19 @@ set -eu
bold=$(tput bold) bold=$(tput bold)
normal=$(tput sgr0) normal=$(tput sgr0)
if ! [ -x "$(command -v gh)" ]; then GH_CLI=.tool/gh
echo "The GitHub CLI could not be found. To continue follow the instructions at https://github.com/cli/cli#installation"
if ! [ -x "$(command -v $GH_CLI)" ]; then
echo "The GitHub CLI could not be found. run: make bootstrap"
exit 1 exit 1
fi fi
gh auth status $GH_CLI auth status
# set the default repo in cases where multiple remotes are defined
$GH_CLI repo set-default anchore/syft
export GITHUB_TOKEN="${GITHUB_TOKEN-"$($GH_CLI auth token)"}"
# we need all of the git state to determine the next version. Since tagging is done by # we need all of the git state to determine the next version. Since tagging is done by
# the release pipeline it is possible to not have all of the tags from previous releases. # the release pipeline it is possible to not have all of the tags from previous releases.
@ -37,7 +44,7 @@ done
echo "${bold}Kicking off release for ${NEXT_VERSION}${normal}..." echo "${bold}Kicking off release for ${NEXT_VERSION}${normal}..."
echo echo
gh workflow run release.yaml -f version=${NEXT_VERSION} $GH_CLI workflow run release.yaml -f version=${NEXT_VERSION}
echo echo
echo "${bold}Waiting for release to start...${normal}" echo "${bold}Waiting for release to start...${normal}"
@ -45,6 +52,6 @@ sleep 10
set +e set +e
echo "${bold}Head to the release workflow to monitor the release:${normal} $(gh run list --workflow=release.yaml --limit=1 --json url --jq '.[].url')" echo "${bold}Head to the release workflow to monitor the release:${normal} $($GH_CLI run list --workflow=release.yaml --limit=1 --json url --jq '.[].url')"
id=$(gh run list --workflow=release.yaml --limit=1 --json databaseId --jq '.[].databaseId') id=$($GH_CLI run list --workflow=release.yaml --limit=1 --json databaseId --jq '.[].databaseId')
gh run watch $id --exit-status || (echo ; echo "${bold}Logs of failed step:${normal}" && GH_PAGER="" gh run view $id --log-failed) $GH_CLI run watch $id --exit-status || (echo ; echo "${bold}Logs of failed step:${normal}" && GH_PAGER="" $GH_CLI run view $id --log-failed)