Skip to content

Commit

Permalink
ENH Handle CMS 6 branches
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 20, 2024
1 parent 467a12c commit 6ec33e9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ runs:
date_part=$(date +%H)
fi
if (( $date_part % 2 == 1 )); then
# latest major, next-minor e.g. "5"
type=latest,next-minor
# current major, next-minor e.g. "5"
type=current,next-minor
else
# previous major, next-patch e.g. "4.13"
type=previous,next-patch
Expand Down Expand Up @@ -53,18 +53,28 @@ runs:
major_branches=$(jq -r '.[] | select(.name | test("^[0-9]+$")) | .name' __branches.json | sort -V -r)
# "major_branches" needs to be quoted to preserve line-breaks
major_branches_count=$(echo "$major_branches" | wc -l)
if [[ $major_type == "latest" ]]; then
if [[ $major_type == "current" ]]; then
if (( $major_branches_count < 1 )); then
echo "No major branches found"
exit 1
fi
major_branch=$(echo "$major_branches" | head -1)
if (( $major_branches_count >= 2 )); then
# There are currently CMS 6 dev branches e.g. 6.x-dev, but no CMS 6 releases yet
# Assume that the 2nd major branch is the current major branch
major_branch=$(echo "$major_branches" | head -2)
fi
elif [[ $major_type == "previous" ]]; then
if (( $major_branches_count < 2 )); then
echo "Only one major branch found, not running CI on this cycle - will run on next cycle"
exit 0
fi
major_branch=$(echo "$major_branches" | head -2 | tail -1)
if (( $major_branches_count >= 2 )); then
# There are currently CMS 6 dev branches e.g. 6.x-dev, but no CMS 6 releases yet
# Assume that the 3rd major branch is the previous major branch
major_branch=$(echo "$major_branches" | head -3 | tail -1))
fi
fi
if [[ $minor_type == "next-patch" ]]; then
# not escaping rx . as \. because jq will say it is a compile error
Expand Down

0 comments on commit 6ec33e9

Please sign in to comment.