File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy to Maven Central
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ jobs :
9+ deploy :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+
14+ - name : Set up JDK 11
15+ uses : actions/setup-java@v4
16+ with :
17+ java-version : ' 11'
18+ distribution : ' zulu'
19+ cache : maven
20+ server-id : central
21+ server-username : MAVEN_CENTRAL_USERNAME
22+ server-password : MAVEN_CENTRAL_PASSWORD
23+ gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
24+ gpg-passphrase : GPG_PASSPHRASE
25+
26+ - name : Set release version from tag
27+ run : mvn -B versions:set -DnewVersion=${GITHUB_REF_NAME#v} -DgenerateBackupPoms=false
28+
29+ - name : Deploy
30+ run : mvn -B deploy -Pdeployment
31+ env :
32+ MAVEN_CENTRAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
33+ MAVEN_CENTRAL_PASSWORD : ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
34+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
Original file line number Diff line number Diff line change @@ -152,6 +152,34 @@ This produces three artifacts:
152152- ` selective-test-runner-core-1.0.0-SNAPSHOT-agent.jar ` : the shaded agent JAR (ASM relocated)
153153- ` test-impact-maven-plugin-1.0.0-SNAPSHOT.jar ` : the Maven plugin
154154
155+ ## Releasing
156+
157+ Releases are published to Maven Central automatically via GitHub Actions when a version tag is pushed.
158+
159+ 1 . Make sure all changes are merged to ` main ` and the build is green
160+ 2 . Tag the release:
161+ ``` bash
162+ git tag v1.0.0
163+ git push origin v1.0.0
164+ ```
165+ 3 . The deployment workflow sets the version from the tag (stripping the ` v ` prefix), signs the artifacts with GPG, and publishes to Maven Central
166+ 4 . After the release, bump the version on ` main ` for the next development cycle:
167+ ``` bash
168+ mvn versions:set -DnewVersion=1.1.0-SNAPSHOT -DgenerateBackupPoms=false
169+ git add pom.xml * /pom.xml
170+ git commit -m " Bump version to 1.0.1-SNAPSHOT"
171+ git push
172+ ```
173+
174+ The deployment workflow requires these GitHub secrets:
175+
176+ | Secret | Description |
177+ | --------| -------------|
178+ | ` MAVEN_CENTRAL_USERNAME ` | Central Portal token username |
179+ | ` MAVEN_CENTRAL_PASSWORD ` | Central Portal token password |
180+ | ` GPG_PRIVATE_KEY ` | Armored GPG private key (` gpg --armor --export-secret-keys <keyid> ` ) |
181+ | ` GPG_PASSPHRASE ` | Passphrase for the GPG key |
182+
155183## Contributing
156184
1571851 . Fork the repository and create a feature branch from ` main `
Original file line number Diff line number Diff line change 5656 <maven-javadoc-plugin .version>3.12.0</maven-javadoc-plugin .version>
5757 <maven-source-plugin .version>3.4.0</maven-source-plugin .version>
5858 <spotless-maven-plugin .version>3.4.0</spotless-maven-plugin .version>
59+ <maven-gpg-plugin .version>3.2.8</maven-gpg-plugin .version>
60+ <central-publishing-maven-plugin .version>0.10.0</central-publishing-maven-plugin .version>
5961 </properties >
6062
6163 <dependencyManagement >
166168 </execution >
167169 </executions >
168170 </plugin >
171+ <plugin >
172+ <groupId >org.apache.maven.plugins</groupId >
173+ <artifactId >maven-gpg-plugin</artifactId >
174+ <version >${maven-gpg-plugin.version} </version >
175+ <configuration >
176+ <keyname >${gpg.keyname} </keyname >
177+ <gpgArguments >
178+ <arg >--pinentry-mode</arg >
179+ <arg >loopback</arg >
180+ </gpgArguments >
181+ </configuration >
182+ <executions >
183+ <execution >
184+ <id >sign-artifacts</id >
185+ <phase >verify</phase >
186+ <goals >
187+ <goal >sign</goal >
188+ </goals >
189+ </execution >
190+ </executions >
191+ </plugin >
192+ <plugin >
193+ <groupId >org.sonatype.central</groupId >
194+ <artifactId >central-publishing-maven-plugin</artifactId >
195+ <version >${central-publishing-maven-plugin.version} </version >
196+ <extensions >true</extensions >
197+ <configuration >
198+ <publishingServerId >central</publishingServerId >
199+ <autoPublish >true</autoPublish >
200+ <waitUntil >uploaded</waitUntil >
201+ </configuration >
202+ </plugin >
169203 </plugins >
170204 </pluginManagement >
171205
194228 <groupId >org.apache.maven.plugins</groupId >
195229 <artifactId >maven-javadoc-plugin</artifactId >
196230 </plugin >
231+ <plugin >
232+ <groupId >org.apache.maven.plugins</groupId >
233+ <artifactId >maven-gpg-plugin</artifactId >
234+ </plugin >
235+ <plugin >
236+ <groupId >org.sonatype.central</groupId >
237+ <artifactId >central-publishing-maven-plugin</artifactId >
238+ </plugin >
197239 </plugins >
198240 </build >
199241 </profile >
You can’t perform that action at this time.
0 commit comments