Skip to content

Commit 7ae6140

Browse files
committed
Fix release tag series to anchor TCASVS at v5
1 parent b04e451 commit 7ae6140

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/main.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: |
5454
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
5555
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" == "null" ]; then
56-
LATEST_TAG="v5.0.0"
56+
LATEST_TAG=""
5757
fi
5858
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
5959
@@ -62,10 +62,19 @@ jobs:
6262
if: github.event_name == 'push'
6363
run: |
6464
LATEST_TAG=${{ env.LATEST_TAG }}
65-
LATEST_VERSION=${LATEST_TAG#v}
66-
IFS='.' read -r major minor patch <<< "$LATEST_VERSION"
67-
NEW_VERSION="$major.$minor.$((patch + 1))"
68-
NEW_TAG="v$NEW_VERSION"
65+
66+
# TCASVS release line is anchored to ASVS-style v5.x tags.
67+
# Ignore legacy TASVS tags (for example v1.8.x) when deriving the next tag.
68+
if [[ "$LATEST_TAG" =~ ^v5\.([0-9]+)\.([0-9]+)$ ]]; then
69+
major=5
70+
minor=${BASH_REMATCH[1]}
71+
patch=${BASH_REMATCH[2]}
72+
NEW_VERSION="$major.$minor.$((patch + 1))"
73+
NEW_TAG="v$NEW_VERSION"
74+
else
75+
NEW_TAG="v5.0.0"
76+
fi
77+
6978
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
7079
7180
- name: Create GitHub Release

0 commit comments

Comments
 (0)