From a5e0c2672b06980fd0aac7b39f3e2bf418bf6b49 Mon Sep 17 00:00:00 2001 From: Jorge Bornhausen Date: Fri, 18 Jul 2025 10:26:00 +0200 Subject: [PATCH] ci(github-actions): revamp build.yaml to trigger on tags and do proper validation of version --- .github/workflows/build.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b32c3db..f99f691 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,8 @@ on: push: branches: - "main" + tags: + - '[0-9]+.[0-9]+.[0-9]+' paths-ignore: - '.gitattributes' - '.gitignore' @@ -12,6 +14,7 @@ on: - 'docs/**' - 'README.md' pull_request: + workflow_dispatch: env: COMMON_MAVEN_OPTS: "-e -B --fae" @@ -73,6 +76,17 @@ jobs: - name: Make maven wrapper executable run: chmod +x mvnw + - name: Validate tag + if: startsWith(github.ref, 'refs/tags/') + run: | + TAG_NAME="${GITHUB_REF#refs/tags/}" + PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) + + if [[ "$PROJECT_VERSION" != "$TAG_NAME" ]]; then + echo "::error::pom.xml version '$PROJECT_VERSION' does not match tag '$TAG_NAME'" + exit 1 + fi + - name: Download dependencies run: ./mvnw $COMMON_MAVEN_OPTS quarkus:go-offline