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: release (undraft) GitHub release from release script #18886

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
36 changes: 27 additions & 9 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,26 @@ 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).
if [ "${BRANCH}" = "main" ]; then
gh_release_args=(--prerelease)
elif [ "${BRANCH}" = "release-3.5" ]; then
gh_release_args=(--latest)
fi
# Explicitly set release arguments per branch.
case "${BRANCH}" in
"main")
gh_release_args=(--latest=false --prerelease=true)
;;
"release-3.5")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to start capturing a list of tasks in an issue and adding it to the https://github.com/etcd-io/etcd/milestone/38 in order to capture the trivial release related tasks we would need to perform in order to safely cut new release-3.6 branch. For example, updating this script to add the release-3.6 logic.

gh_release_args=(--latest=true --prerelease=false)
;;
*)
gh_release_args=(--latest=false --prerelease=false)
;;
esac

if [ "${REPOSITORY}" = "$(pwd)" ]; then
gh_repo=$(git remote get-url origin)
Expand Down Expand Up @@ -391,8 +398,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with a bit more testing / confidence we can simply drop the publishing of the release in draft mode and 10 minute review prompt and simply publish the full release.

It was a really great milestone to see the script automatically creating the GitHub release for us today so let's just get a bit more confidence in the next round of releases and then revisit it :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I was hesitant to add this change, but no matter what arguments I'd pass to gh create release, the draft release in the edit UI always has the "set as latest release" checkbox ticked. So, the workaround was to publish the release by editing it, while passing all the possible arguments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to draft this PR then. We can revisit it when we feel confident about automating the release process.

if [[ "${confirm,,}" == "y" ]]; then
maybe_run 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

log_success "Success."
Expand Down