Skip to content

Commit cebda6c

Browse files
committed
Use GPG key to sign artifacts
1 parent 0b98a76 commit cebda6c

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/maven-publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ jobs:
2525
server-id: ossrh
2626
server-username: MAVEN_USERNAME
2727
server-password: MAVEN_PASSWORD
28+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
29+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
2830

2931
- name: Publish package
30-
run: mvn --batch-mode deploy
32+
run: mvn --batch-mode deploy -Prelease
3133
env:
3234
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3335
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
36+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

pom.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,36 @@
7373
</plugins>
7474
</build>
7575

76+
<profiles>
77+
<profile>
78+
<id>release</id>
79+
<build>
80+
<plugins>
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-gpg-plugin</artifactId>
84+
<version>3.2.7</version>
85+
<executions>
86+
<execution>
87+
<id>sign-artifacts</id>
88+
<phase>verify</phase>
89+
<goals>
90+
<goal>sign</goal>
91+
</goals>
92+
</execution>
93+
</executions>
94+
<configuration>
95+
<gpgArguments>
96+
<arg>--pinentry-mode</arg>
97+
<arg>loopback</arg>
98+
</gpgArguments>
99+
</configuration>
100+
</plugin>
101+
</plugins>
102+
</build>
103+
</profile>
104+
</profiles>
105+
76106
<dependencies>
77107
<dependency>
78108
<groupId>junit</groupId>

0 commit comments

Comments
 (0)