Skip to content

Commit

Permalink
ci: fix create-hot-fix-tag workflow to filter for CalVer tags (#3463
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ShankarSinghC authored Jan 28, 2024
1 parent 66cd5b2 commit 98bf8f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-hotfix-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Check if the input is valid tag
shell: bash
run: |
if [[ ${{github.ref}} =~ ^refs/tags/[0-9]{4}\.[0-9]{2}\.[0-9]{2}.[0-9]+$ ]]; then
if [[ ${{github.ref}} =~ ^refs/tags/[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.[0-9]+$ ]]; then
echo "::notice::${{github.ref}} is a CalVer tag."
else
echo "::error::${{github.ref}} is not a CalVer tag."
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/create-hotfix-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Check if the input is valid hotfix branch
shell: bash
run: |
if [[ ${{github.ref}} =~ ^refs/heads/hotfix-[0-9]{4}\.[0-9]{2}\.[0-9]{2}.[0-9]+$ ]]; then
if [[ ${{github.ref}} =~ ^refs/heads/hotfix-[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.[0-9]+$ ]]; then
echo "::notice::${{github.ref}} is a valid hotfix branch."
else
echo "::error::${{github.ref}} is not a valid hotfix branch."
Expand All @@ -56,7 +56,7 @@ jobs:
local previous_hotfix_number
local next_tag
previous_hotfix_number="$(echo "${previous_tag}" | awk -F. '{ print $4 }' | gsed -oE 's/([0-9]+)(-hotfix([0-9]+))?/\3/')"
previous_hotfix_number="$(echo "${previous_tag}" | awk -F. '{ print $4 }' | sed -E 's/([0-9]+)(-hotfix([0-9]+))?/\3/')"
if [[ -z "${previous_hotfix_number}" ]]; then
# Previous tag was not a hotfix tag
Expand All @@ -70,7 +70,13 @@ jobs:
echo "${next_tag}"
}
PREVIOUS_TAG="$(git tag --merged | sort --version-sort | tail --lines 1)"
# Search for date-like tags (no strict checking), sort and obtain previous tag
PREVIOUS_TAG="$(
git tag --merged \
| grep --extended-regexp '[0-9]{4}\.[0-9]{2}\.[0-9]{2}' \
| sort --version-sort \
| tail --lines 1
)"
NEXT_TAG="$(get_next_tag "${PREVIOUS_TAG}")"
echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV
Expand Down

0 comments on commit 98bf8f5

Please sign in to comment.