51
51
name : Build and publish to Maven Central 🔨
52
52
runs-on : [self-hosted, Linux, X64]
53
53
env :
54
+ MAVEN_PROFILES : releaseSonatype
54
55
MAVEN_ARGS : -Dmaven.test.skip=true
55
56
outputs :
56
57
pom_version : ${{ needs.bump.outputs.pom_version }}
75
76
server-id : maven
76
77
server-username : ${{ secrets.SONATYPE_USERNAME }}
77
78
server-password : ${{ secrets.SONATYPE_PASSWORD }}
78
- - name : Set up GPG for CI ⚙️
79
+ - name : Set up GPG for CI 🔐
79
80
run : |
80
81
which gpg2 || sudo apt update && sudo apt install -y gnupg2
81
82
mkdir -p ~/.gnupg
87
88
echo "max-cache-ttl 7200" >> ~/.gnupg/gpg-agent.conf
88
89
gpgconf --kill gpg-agent
89
90
gpgconf --launch gpg-agent
90
- - name : Import GPG key using gpg2 🔐
91
- run : |
92
91
echo "${{ secrets.GPG_SECRET_KEY }}" | base64 --decode | gpg2 --batch --yes --import
93
92
echo "${{ secrets.GPG_OWNERTRUST }}" | base64 --decode | gpg2 --import-ownertrust
94
93
export GPG_TTY=$(tty)
95
- export GPG_EXECUTABLE=gpg2
96
94
- name : Write .m2/settings.xml 💾
97
95
run : |
98
96
mkdir -p ~/.m2
@@ -111,14 +109,14 @@ jobs:
111
109
EOF
112
110
- name : Conditionally setup Maven ⚙️
113
111
run : |
114
- wihch mvn || sudo apt update && sudo apt install -y maven
112
+ wihch mvn || ( sudo apt update && sudo apt install -y maven)
115
113
- name : Update pom.xml version 💾
116
114
run : |
117
115
mvn versions:set -DnewVersion=${{ needs.bump.outputs.major_version }}.${{ needs.bump.outputs.minor_version }}.${{ needs.bump.outputs.build_version }} -DgenerateBackupPoms=false
118
116
- name : Build and publish with Maven 🔨
119
117
env :
120
118
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
122
120
- name : List signed files 🐞
123
121
run : |
124
122
echo "📦 Contents of target/:"
@@ -129,6 +127,7 @@ jobs:
129
127
echo ""
130
128
echo "❓ Missing POM signature?" && test ! -f target/*pom.asc && echo "❌ No POM signature found!" || echo "✅ POM is signed."
131
129
- name : Upload build artifacts ⬆️
130
+ if : ${{ always() && hashFiles('target/*.jar') != '' }}
132
131
uses : actions/upload-artifact@v4
133
132
with :
134
133
name : maven-artifacts
0 commit comments