Skip to content

Commit

Permalink
Merge pull request #994 from actions/ncalteen/release
Browse files Browse the repository at this point in the history
Fix error during initial release script run
  • Loading branch information
ncalteen authored Jan 10, 2025
2 parents e29f035 + cafe8ed commit c065465
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,20 @@ git tag "$new_tag" --annotate --message "$new_tag Release"
echo -e "Tagged: ${BOLD_GREEN}$new_tag${OFF}"

# 7. Set 'is_major_release' variable
latest_major_release_tag=$(expr "$latest_tag" : "$major_semver_tag_regex")
new_major_release_tag=$(expr "$new_tag" : "$major_semver_tag_regex")

if ! [[ "$new_major_release_tag" = "$latest_major_release_tag" ]]; then
if [[ "$latest_tag" = "[unknown]" ]]; then
# This is the first major release
is_major_release='yes'
else
is_major_release='no'
# Compare the major version of the latest tag with the new tag
latest_major_release_tag=$(expr "$latest_tag" : "$major_semver_tag_regex")

if ! [[ "$new_major_release_tag" = "$latest_major_release_tag" ]]; then
is_major_release='yes'
else
is_major_release='no'
fi
fi

# 8. Point separate major release tag (e.g. v1, v2) to the new release
Expand Down Expand Up @@ -116,10 +123,10 @@ fi

# 10. If this is a major release, create a 'releases/v#' branch and push
if [ $is_major_release = 'yes' ]; then
git branch "releases/$latest_major_release_tag" "$latest_major_release_tag"
echo -e "Branch: ${BOLD_BLUE}releases/$latest_major_release_tag${OFF} created from ${BOLD_BLUE}$latest_major_release_tag${OFF} tag"
git push --set-upstream $git_remote "releases/$latest_major_release_tag"
echo -e "Branch: ${BOLD_GREEN}releases/$latest_major_release_tag${OFF} pushed to remote"
git branch "releases/$new_major_release_tag" "$new_major_release_tag"
echo -e "Branch: ${BOLD_BLUE}releases/$new_major_release_tag${OFF} created from ${BOLD_BLUE}$new_major_release_tag${OFF} tag"
git push --set-upstream $git_remote "releases/$new_major_release_tag"
echo -e "Branch: ${BOLD_GREEN}releases/$new_major_release_tag${OFF} pushed to remote"
fi

# Completed
Expand Down

0 comments on commit c065465

Please sign in to comment.