Skip to content

Commit fe235a7

Browse files
committed
Add semver validation
1 parent af405b5 commit fe235a7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- v[0-9]+\.[0-9]+\.[0-9]+(-[A-Z])?
7+
- 'v*'
88

99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
@@ -16,6 +16,19 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818

19+
# VALIDATE TAGS
20+
- id: validate-semver
21+
name: Validate tag against semantic versioning
22+
if: startsWith(github.ref, 'refs/tags/')
23+
shell: bash
24+
run: |
25+
SEMVER_PATTERN="^refs/tags/v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
26+
if [[ ! $GITHUB_REF =~ $SEMVER_PATTERN ]]
27+
then
28+
echo "Tag $GITHUB_REF does not follow semantic versioning"
29+
exit 1
30+
fi
31+
1932
# SETUP BUILD ENVIRONMENT
2033
- id: prepare-maven-build
2134
name: Prepare Maven build

0 commit comments

Comments
 (0)