From 90d7b599fd5aa22a7a0ae605db08024b9d166c13 Mon Sep 17 00:00:00 2001 From: Julien Ponge Date: Fri, 22 Sep 2023 12:00:53 +0200 Subject: [PATCH] ci: skip work on the main branch when facing a release commit --- .github/workflows/build-main.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index e7090ac15..933e52725 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -22,10 +22,17 @@ jobs: cache: maven - name: Install just uses: taiki-e/install-action@just - - name: Build with Maven - run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify - - name: Deploy snapshots + - name: Test and deploy snapshots env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SECRET_FILES_PASSPHRASE: ${{ secrets.SECRET_FILES_PASSPHRASE }} - run: just -f .build/justfile-for-release -d . deploy-to-maven-central + run: | + VERSION=$(./mvnw -q exec:exec -Dexec.executable=echo -Dexec.args='${project.version}' -pl :mutiny-project) + if [[ ${VERSION} == *SNAPSHOT ]]; then + echo "🚀 Run the tests" + ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify + echo "🚀 Deploy the snapshots" + just -f .build/justfile-for-release -d . deploy-to-maven-central + else + echo "🤌 This is a release commit, we won't do anything!" + fi