github.com/quay/claircore@v1.5.28/.github/scripts/prepare-release (about) 1 #!/bin/sh 2 set -e 3 command -v gh >/dev/null 2>&1 || { 4 printf 'need "gh" tool: https://github.com/cli/cli\n'>&2 5 exit 1 6 } 7 : "${GH_REPO:=quay/claircore}" 8 export GH_REPO 9 : "${BRANCH:=$(git branch --show-current)}" 10 # Autodetect weirdos that use upsteam+origin instead of origin+fork. 11 : "${REMOTE:=$(git remote | grep -q '^upstream$' && echo upstream || echo origin)}" 12 while getopts hb:r: arg; do 13 case "$arg" in 14 b) BRANCH="$OPTARG";; 15 r) REMOTE="$OPTARG";; 16 ?) printf 'usage: %s: [-h] [-b BRANCH] [-r REMOTE] version\n' "$0" 17 exit 2;; 18 esac 19 done 20 shift $((OPTIND - 1)) 21 VERSION="${1:?need a version argument}" 22 VERSION="v${VERSION#v}" 23 24 prs=$(gh search prs --repo $GH_REPO --state closed --merged --label=needs-changelog --json=title,url | jq -r '.[] | (.url | @text) + " - " + (.title | @text)') 25 if [ -n "$prs" ] 26 then 27 echo "There are still PRs that need changelog entries" 28 echo $prs 29 exit 1 30 fi 31 32 printf 'operating on branch: %s\n' "$BRANCH" >&2 33 gh workflow run prepare-release.yml -F "branch=$BRANCH" -F "tag=$VERSION" 34 # TODO(hank) Watch for a gh update that has the above command output the ID. 35 id=$(gh run list --workflow=prepare-release.yml --limit=1 | grep -Eo '[0-9]{9,}') 36 gh run watch "${id}" 37 cat <<. 38 Now, to merge and release: 39 40 git checkout ${BRANCH} 41 git fetch ${REMOTE} 42 git merge --ff-only ${REMOTE}/ready-${VERSION} 43 git tag -s ${VERSION} 44 git push ${REMOTE} ${BRANCH} :ready-${VERSION} tag ${VERSION} 45 46 .