From 6948060205bd13450b1ae7b3356a1de7534bff84 Mon Sep 17 00:00:00 2001 From: MOHANKUMAR T <31698165+mohan-13@users.noreply.github.com> Date: Mon, 26 Aug 2024 03:04:46 +0000 Subject: [PATCH] BAH-3807 | Fix. Skip build and publish workflow if build has a fixed version --- .github/workflows/build_publish.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 53e640b..925deb2 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -1,7 +1,7 @@ name: Build and Publish package on: push: - branches: [ master ] + branches: [ master, BAH-3807 ] jobs: build-publish-package: @@ -17,7 +17,13 @@ jobs: server-username: NEXUS_USERNAME server-password: NEXUS_PASSWORD - name: Build and deploy with Maven - run: ./mvnw --no-transfer-progress clean -U deploy + run: | + PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) + if [[ "$VERSION" == *"-SNAPSHOT" ]]; then + ./mvnw --no-transfer-progress clean -U deploy + else + echo "❌ The current push is for release. So skipping build." + fi env: NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}