Skip to content

release: release (undraft) GitHub release from release script #18886

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

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
33 changes: 23 additions & 10 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,17 @@ main() {
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)
local prompt
log_warning "WARNING: Only releases from the latest stable branch should be marked as the latest release"
read -p "Mark this as a the latest release [y/N]? " -r prompt
if [[ "${prompt,,}" == "y" ]]; then
gh_release_args=(--latest=true)
else
log_warning "WARNING: Only releases from the latest unstable branch should be marked as pre-releases (i.e., alpha, beta, or release candidates)"
read -p "Mark this as a pre-release [y/N]? " -r prompt
if [[ "${prompt,,}" == "y" ]]; then
gh_release_args=(--prerelease=true)
fi
fi

if [ "${REPOSITORY}" = "$(pwd)" ]; then
Expand Down Expand Up @@ -392,9 +396,18 @@ 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 ""
# 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.

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 left this in place, as it follows the approach of the other steps.

if [[ "${confirm,,}" == "y" ]]; then
maybe_run gh release edit "${RELEASE_VERSION}" \
--repo "${gh_repo}" \
--draft=false \
"${gh_release_args[@]}"
else
log_warning ""
log_warning "WARNING: The GitHub release for ${RELEASE_VERSION} has been created as a draft, please review it at ${release_url}."
log_warning ""
fi
fi

log_success "Success."
Expand Down