Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvc committed Nov 12, 2024
1 parent c390f63 commit 8421312
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ main() {
REPOSITORY=$(pwd)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
else
REPOSITORY=${REPOSITORY:-"https://github.com/etcd-io/etcd.git"}
REPOSITORY=${REPOSITORY:-"git@github.com:etcd-io/etcd.git"}
BRANCH=${BRANCH:-"release-${MINOR_VERSION}"}
fi

Expand Down Expand Up @@ -306,18 +306,23 @@ main() {
log_warning "WARNING: If not running on DRY_MODE, please do the GitHub release manually."
log_warning ""
else
read -p "Create GitHub draft release in ${REPOSITORY} [y/N]? " -r confirm
[[ "${confirm,,}" == "y" ]] || exit 1

local gh_repo
local release_notes_temp_file
local release_url
local gh_release_args=()

# For the main branch (v3.6), we should mark the release as a prerelease.
# The release-3.5 (v3.5) branch, should be marked as latest. And release-3.4 (v3.4)
# should be left without any additional mark (therefore, it doesn't need a special argument).
# The release-3.5 (v3.5) branch, should be marked as latest. Otherwise
# (i.e., v3.4) should be set as not latest.
if [ "${BRANCH}" = "main" ]; then
gh_release_args=(--prerelease)
gh_release_args=(--prerelease=true --latest=false)
elif [ "${BRANCH}" = "release-3.5" ]; then
gh_release_args=(--latest)
gh_release_args=(--latest=true --prerelease=false)
else
gh_release_args=(--latest=false --prerelease=false)
fi

if [ "${REPOSITORY}" = "$(pwd)" ]; then
Expand Down Expand Up @@ -363,8 +368,19 @@ main() {
release_url=$(gh --repo "${gh_repo}" release view "${RELEASE_VERSION}" --json url --jq '.url')

log_warning ""
log_warning "WARNING: The GitHub release for ${RELEASE_VERSION} has been created as a draft, please go to ${release_url} and release it."
log_warning "WARNING: The GitHub release for ${RELEASE_VERSION} has been created as a draft, please review it at ${release_url}."
log_warning ""

# Give a 10 minute timeout to the user to confirm the release.
read -p "Release GitHub release for ${RELEASE_VERSION} [y/N]? " -t 600 -r confirm
if [[ "${confirm,,}" == "y" ]]; then
gh release edit "${RELEASE_VERSION}" \
--repo "${gh_repo}" \
--draft=false \
"${gh_release_args[@]}"
else
log_warning "GitHub release for ${RELEASE_VERSION} has not been released. If manually releasing, please ensure that the bottom checkboxes are as expected (v3.4 with no option selected, v3.5 set as the latest release, v3.6 set as pre-release)."
fi
fi
fi

Expand Down

0 comments on commit 8421312

Please sign in to comment.