Skip to content

Commit cc2f24a

Browse files
committed
Deploy releases on tag push, snapshots on branch push
Prevents double deployment during release:prepare by checking POM version before deploying. Branch pushes only deploy if version contains -SNAPSHOT; tag pushes only deploy if it does not.
1 parent fc1bcbd commit cc2f24a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/maven.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Maven Build and Deployment
33
on:
44
push:
55
branches: [ master ]
6+
tags: [ 'lmdbjava-*' ]
67
pull_request:
78
branches: [ master ]
89

@@ -84,7 +85,14 @@ jobs:
8485
gpg-private-key: ${{ secrets.gpg_private_key }}
8586
gpg-passphrase: MAVEN_GPG_PASSPHRASE
8687

88+
- name: Get project version
89+
id: version
90+
run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
91+
8792
- name: Publish Maven package
93+
if: |
94+
(github.ref_type == 'branch' && contains(steps.version.outputs.version, '-SNAPSHOT')) ||
95+
(github.ref_type == 'tag' && !contains(steps.version.outputs.version, '-SNAPSHOT'))
8896
run: mvn -B -Pcentral-deploy deploy -DskipTests
8997
env:
9098
MAVEN_GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}

0 commit comments

Comments
 (0)