Skip to content

chore(scripts): fix release tagging sanity checks #13073

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

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
handle existing branch better if unreleased
  • Loading branch information
mafredri committed Apr 25, 2024
commit 5e25efc6fa3b9ccbbd383bbd6a6fddca09d7728f
19 changes: 16 additions & 3 deletions scripts/release/tag_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,24 @@ else
if [[ ${prev_increment} == patch ]]; then
error "Release branch ${release_branch} already exists, impossible upgrade from \"${prev_increment}\" to \"${increment}\" detected. Please check your ref (${ref_name}) and that no incompatible commits were cherry-picked."
fi
error "Release branch ${release_branch} already exists, please check your ref."
fi

log "Creating new release branch"
maybedryrun "$dry_run" git checkout -b "${release_branch}" "${ref}"
if [[ -n ${remote_branch_exists} ]]; then
error "Release branch ${release_branch} already exists on remote, please check your ref."
fi

if [[ -n ${local_branch_exists} ]]; then
# If it exists, ensure that this release branch points to the provided ref.
release_branch_ref=$(git rev-parse "${release_branch}")
if [[ ${release_branch_ref} != "${ref}" ]]; then
error "Local release branch ${release_branch} already exists, but does not point to the provided ref (${ref_name})."
fi
log "Using existing release branch"
maybedryrun "$dry_run" git checkout "${release_branch}"
else
log "Creating new release branch"
maybedryrun "$dry_run" git checkout -b "${release_branch}" "${ref}"
fi
fi

# Ensure the ref is in the release branch.
Expand Down
Loading