5151 name : Build and publish to Maven Central 🔨
5252 runs-on : [self-hosted, Linux, X64]
5353 env :
54+ MAVEN_PROFILES : releaseSonatype
5455 MAVEN_ARGS : -Dmaven.test.skip=true
5556 outputs :
5657 pom_version : ${{ needs.bump.outputs.pom_version }}
7576 server-id : maven
7677 server-username : ${{ secrets.SONATYPE_USERNAME }}
7778 server-password : ${{ secrets.SONATYPE_PASSWORD }}
78- - name : Set up GPG for CI ⚙️
79+ - name : Set up GPG for CI 🔐
7980 run : |
8081 which gpg2 || sudo apt update && sudo apt install -y gnupg2
8182 mkdir -p ~/.gnupg
8788 echo "max-cache-ttl 7200" >> ~/.gnupg/gpg-agent.conf
8889 gpgconf --kill gpg-agent
8990 gpgconf --launch gpg-agent
90- - name : Import GPG key using gpg2 🔐
91- run : |
9291 echo "${{ secrets.GPG_SECRET_KEY }}" | base64 --decode | gpg2 --batch --yes --import
9392 echo "${{ secrets.GPG_OWNERTRUST }}" | base64 --decode | gpg2 --import-ownertrust
9493 export GPG_TTY=$(tty)
95- export GPG_EXECUTABLE=gpg2
9694 - name : Write .m2/settings.xml 💾
9795 run : |
9896 mkdir -p ~/.m2
@@ -111,14 +109,14 @@ jobs:
111109 EOF
112110 - name : Conditionally setup Maven ⚙️
113111 run : |
114- wihch mvn || sudo apt update && sudo apt install -y maven
112+ wihch mvn || ( sudo apt update && sudo apt install -y maven)
115113 - name : Update pom.xml version 💾
116114 run : |
117115 mvn versions:set -DnewVersion=${{ needs.bump.outputs.major_version }}.${{ needs.bump.outputs.minor_version }}.${{ needs.bump.outputs.build_version }} -DgenerateBackupPoms=false
118116 - name : Build and publish with Maven 🔨
119117 env :
120118 MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
121- run : mvn clean deploy --batch-mode --update-snapshots -DreleaseSonatype=true $MAVEN_ARGS
119+ run : mvn clean deploy --batch-mode --update-snapshots -P${{ env.MAVEN_PROFILES }} $MAVEN_ARGS
122120 - name : List signed files 🐞
123121 run : |
124122 echo "📦 Contents of target/:"
@@ -129,6 +127,7 @@ jobs:
129127 echo ""
130128 echo "❓ Missing POM signature?" && test ! -f target/*pom.asc && echo "❌ No POM signature found!" || echo "✅ POM is signed."
131129 - name : Upload build artifacts ⬆️
130+ if : ${{ always() && hashFiles('target/*.jar') != '' }}
132131 uses : actions/upload-artifact@v4
133132 with :
134133 name : maven-artifacts
0 commit comments