From 05b32bd86b05fb66a9fd6c179ddd2348e5c034c5 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 18 Sep 2024 09:35:11 -0300 Subject: [PATCH] Use Maven Wrapper if available --- .github/workflows/perform-release.yml | 10 +++++++++- .github/workflows/prepare-release.yml | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/perform-release.yml b/.github/workflows/perform-release.yml index 3a31839..ecc8aa7 100644 --- a/.github/workflows/perform-release.yml +++ b/.github/workflows/perform-release.yml @@ -66,8 +66,16 @@ jobs: java-version: 21 cache: 'maven' + - name: Detect Maven Wrapper + run: | + if [ -f mvnw ]; then + echo "MAVEN_EXEC=./mvnw" >> $GITHUB_ENV + else + echo "MAVEN_EXEC=mvn" >> $GITHUB_ENV + fi + - name: Deploy release ${{env.RELEASE_VERSION}} - run: mvn deploy -DperformRelease -DaltDeploymentRepository=local::file://${{ github.workspace }}/repository + run: ${MAVEN_EXEC} deploy -DperformRelease -DaltDeploymentRepository=local::file://${{ github.workspace }}/repository - name: Tarball the artifacts run: tar -czvf ${ARTIFACT_PATH} -C repository . diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 07369ff..5994d14 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -73,10 +73,18 @@ jobs: java-version: 21 cache: 'maven' + - name: Detect Maven Wrapper + run: | + if [ -f mvnw ]; then + echo "MAVEN_EXEC=./mvnw" >> $GITHUB_ENV + else + echo "MAVEN_EXEC=mvn" >> $GITHUB_ENV + fi + - name: Maven release ${{env.CURRENT_VERSION}} run: | - mvn -B release:prepare -Prelease -Dgpg.skip=true -DreleaseVersion=${CURRENT_VERSION} -DdevelopmentVersion=${NEXT_VERSION} -DscmCommentPrefix="[skip ci] " -Drelease.arguments="-Dgpg.skip=true" - mvn -B release:clean + ${MAVEN_EXEC} -B release:prepare -Prelease -Dgpg.skip=true -DreleaseVersion=${CURRENT_VERSION} -DdevelopmentVersion=${NEXT_VERSION} -DscmCommentPrefix="[skip ci] " -Drelease.arguments="-Dgpg.skip=true" + ${MAVEN_EXEC} -B release:clean - name: Push changes to ${{github.base_ref}} branch and tag ${{env.CURRENT_VERSION}} run: |