Skip to content

Commit f3dd3c1

Browse files
committed
Add gpg signing and use release scripts
1 parent 708d1a5 commit f3dd3c1

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

ci/release/Jenkinsfile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,19 @@ pipeline {
5858
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
5959
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
6060
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
61-
sshagent(['ed25519.Hibernate-CI.github.com']) {
62-
sh 'cat $HOME/.ssh/config'
63-
sh """ \
64-
./mvnw release:prepare \
65-
-Dtag=${releaseVersion.toString()} \
66-
-DreleaseVersion=${releaseVersion.toString()} \
67-
-DdevelopmentVersion=${developmentVersion.toString()} \
68-
-Prelease \
69-
"""
70-
sh """ \
71-
./mvnw release:perform ${params.RELEASE_DRY_RUN ? '-DdryRun' : ''} -Prelease \
72-
"""
61+
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
62+
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
63+
string(credentialsId: 'release.gpg.passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) {
64+
sshagent(['ed25519.Hibernate-CI.github.com']) {
65+
sh 'mvn -v'
66+
sh 'cat $HOME/.ssh/config'
67+
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git'
68+
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg'
69+
sh """
70+
bash -xe hibernate-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \
71+
infra-develocity ${releaseVersion.toString()} ${developmentVersion.toString()}
72+
"""
73+
}
7374
}
7475
}
7576
}

pom.xml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
<maven.compiler.source>17</maven.compiler.source>
2323
<maven.compiler.release>17</maven.compiler.release>
2424
<maven.compiler.parameters>true</maven.compiler.parameters>
25-
<maven-release-plugin.version>3.1.1</maven-release-plugin.version>
2625
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
2726
<maven-javadoc-plugin.version>3.11.1</maven-javadoc-plugin.version>
2827
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
2928
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
29+
<version.gpg.plugin>3.2.7</version.gpg.plugin>
30+
31+
<gpg.sign.skip>true</gpg.sign.skip>
3032

3133
<!-- Repository Deployment URLs -->
3234
<ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
@@ -152,6 +154,25 @@
152154
</transformers>
153155
</configuration>
154156
</plugin>
157+
<plugin>
158+
<groupId>org.apache.maven.plugins</groupId>
159+
<artifactId>maven-gpg-plugin</artifactId>
160+
<version>${version.gpg.plugin}</version>
161+
<executions>
162+
<execution>
163+
<id>sign-artifacts</id>
164+
<phase>verify</phase>
165+
<goals>
166+
<goal>sign</goal>
167+
</goals>
168+
<configuration>
169+
<skip>${gpg.sign.skip}</skip>
170+
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
171+
<bestPractices>true</bestPractices>
172+
</configuration>
173+
</execution>
174+
</executions>
175+
</plugin>
155176
</plugins>
156177
</build>
157178

@@ -206,18 +227,17 @@
206227
<profiles>
207228
<profile>
208229
<id>release</id>
230+
<activation>
231+
<property>
232+
<name>performRelease</name>
233+
<value>true</value>
234+
</property>
235+
</activation>
236+
<properties>
237+
<gpg.sign.skip>false</gpg.sign.skip>
238+
</properties>
209239
<build>
210240
<plugins>
211-
<plugin>
212-
<groupId>org.apache.maven.plugins</groupId>
213-
<artifactId>maven-release-plugin</artifactId>
214-
<version>${maven-release-plugin.version}</version>
215-
<configuration>
216-
<autoVersionSubmodules>true</autoVersionSubmodules>
217-
<tagNameFormat>@{project.version}</tagNameFormat>
218-
<localCheckout>true</localCheckout>
219-
</configuration>
220-
</plugin>
221241
<plugin>
222242
<groupId>org.sonatype.plugins</groupId>
223243
<artifactId>nexus-staging-maven-plugin</artifactId>

0 commit comments

Comments
 (0)