Skip to content

Commit 8883b75

Browse files
committed
Improve GH action to avoid attempts to deploy non-SNAPSHOT version (during release process)
1 parent 5a61eb0 commit 8883b75

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ jobs:
3434
# See https://github.com/actions/setup-java/blob/v2/docs/advanced-usage.md#Publishing-using-Apache-Maven
3535
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
3636
# gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
37-
- name: Build
37+
- name: Build project
3838
run: ./mvnw -V -B -ff -ntp verify
39+
- name: Extract project Maven version
40+
id: projectVersion
41+
run: echo ::set-output name=version::$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -DforceStdout -Dexpression=project.version -q)
3942
- name: Deploy snapshot
40-
if: github.event_name != 'pull_request' && matrix.java_version == '8'
41-
env:
43+
if: github.event_name != 'pull_request' && matrix.java_version == '8' && endsWith(steps.projectVersion.output env:
4244
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
4345
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
4446
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)