Skip to content

Commit 9338b41

Browse files
committed
feat(ci): sign artifacts for deployment to maven central
1 parent f804324 commit 9338b41

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
with:
3535
distribution: 'temurin'
3636
java-version: '21'
37+
server-id: central
38+
server-username: MAVEN_USERNAME
39+
server-password: MAVEN_PASSWORD
40+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
41+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3742

3843
- name: Configure Git
3944
run: |
@@ -52,8 +57,12 @@ jobs:
5257
git diff --staged --quiet || git commit -m "Bump version to ${{ github.event.inputs.new_version }}"
5358
git push origin main
5459
55-
- name: Build Project
56-
run: ./mvnw clean package --batch-mode
60+
- name: Build and Deploy to Maven Central
61+
run: ./mvnw clean deploy --batch-mode
62+
env:
63+
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
64+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
65+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5766

5867
- name: Create GitHub Release
5968
uses: softprops/action-gh-release@v1

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@
7979
<publishingServerId>central</publishingServerId>
8080
</configuration>
8181
</plugin>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-gpg-plugin</artifactId>
85+
<version>3.2.8</version>
86+
<executions>
87+
<execution>
88+
<id>sign-artifacts</id>
89+
<phase>verify</phase>
90+
<goals>
91+
<goal>sign</goal>
92+
</goals>
93+
</execution>
94+
</executions>
95+
</plugin>
8296
</plugins>
8397
</build>
8498
</project>

0 commit comments

Comments
 (0)