Skip to content

Commit fc92998

Browse files
authored
GH-805: Migrate to new Maven Central registry (#806)
Migrates to the new Maven Central release registry. Fixes GH-805. --------- Co-authored-by: ascopes <ascopes@users.noreply.github.com>
1 parent 16c7804 commit fc92998

File tree

3 files changed

+30
-35
lines changed

3 files changed

+30
-35
lines changed

.github/workflows/deploy.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy a branch
1+
name: Release new version
22

33
on:
44
workflow_dispatch:
@@ -8,14 +8,19 @@ on:
88
default: false
99
type: boolean
1010

11+
skip-tests:
12+
description: "Skip unit and integration tests"
13+
default: false
14+
type: boolean
15+
1116
version:
1217
description: "Override deployment version"
1318
default: ""
1419
type: string
1520

1621
jobs:
17-
maven-central:
18-
name: Deploy to Maven Central
22+
release:
23+
name: Release
1924
environment:
2025
name: maven-central
2126
url: https://repo1.maven.org/maven2/io/github/ascopes/jct/java-compiler-testing/
@@ -35,14 +40,14 @@ jobs:
3540
uses: actions/setup-java@v4
3641
with:
3742
distribution: zulu
38-
java-version: 23
39-
server-id: ossrh
40-
server-username: OSSRH_USERNAME
41-
server-password: OSSRH_TOKEN
43+
java-version: 24
44+
server-id: central
45+
server-username: CENTRAL_USERNAME
46+
server-password: CENTRAL_TOKEN
4247
gpg-passphrase: GPG_PASSPHRASE
4348
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
4449

45-
- name: Deploy to staging
50+
- name: Create Maven Central Release
4651
shell: bash
4752
run: |-
4853
git config user.name '${{ github.actor }}'
@@ -58,30 +63,26 @@ jobs:
5863
./mvnw -B -e \
5964
-Preleases \
6065
-DdryRun='${{ inputs.dry-run }}' \
66+
-Dinvoker.skip='${{ inputs.skip-tests }}' \
6167
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
6268
-DreleaseVersion="${release_version}" \
6369
-DsignTag=false \
70+
-DskipTests='${{ inputs.skip-tests }}' \
6471
-Dtag="v${release_version}" \
6572
clean verify release:prepare release:perform
66-
67-
echo "Created staging release for ${group_id}/${artifact_id}/${release_version}"
6873
env:
69-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
70-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
74+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
75+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
7176
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
7277

73-
- name: Abort and rollback staging release
78+
- name: Revert Maven Central Release
7479
if: ${{ failure() }}
7580
run: |-
7681
./mvnw -B -e \
7782
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
7883
-DreleaseVersion="${release_version}" \
7984
-Dtag="v${release_version}" \
8085
release:rollback
81-
env:
82-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
83-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
84-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
8586
8687
- name: Create GitHub Release
8788
if: ${{ ! inputs.dry-run }}

java-compiler-testing/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>io.github.ascopes.jct</groupId>
2424
<artifactId>java-compiler-testing-parent</artifactId>
25-
<version>5.0.2-SNAPSHOT</version>
25+
<version>5.0.2-rc2-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

pom.xml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>io.github.ascopes.jct</groupId>
2323
<artifactId>java-compiler-testing-parent</artifactId>
24-
<version>5.0.2-SNAPSHOT</version>
24+
<version>5.0.2-rc2-SNAPSHOT</version>
2525
<packaging>pom</packaging>
2626

2727
<name>Java Compiler Testing parent project</name>
@@ -57,15 +57,10 @@
5757

5858
<distributionManagement>
5959
<repository>
60-
<id>ossrh</id>
61-
<name>Maven Central Releases</name>
62-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
60+
<id>central</id>
61+
<name>Maven Central</name>
62+
<url>https://central.sonatype.com</url>
6363
</repository>
64-
<snapshotRepository>
65-
<id>ossrh</id>
66-
<name>Maven Central Snapshots</name>
67-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
68-
</snapshotRepository>
6964
</distributionManagement>
7065

7166
<issueManagement>
@@ -104,6 +99,7 @@
10499
<slf4j.version>2.0.17</slf4j.version>
105100

106101
<!-- Plugins -->
102+
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
107103
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
108104
<license-maven-plugin.version>5.0.0</license-maven-plugin.version>
109105
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
@@ -119,7 +115,6 @@
119115
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
120116
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
121117
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
122-
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
123118

124119
<!-- Plugin dependencies -->
125120
<checkstyle.version>10.23.0</checkstyle.version>
@@ -684,15 +679,14 @@
684679
and then triggering a "closure" operation that will promote it to
685680
the public Maven repository.
686681
-->
687-
<groupId>org.sonatype.plugins</groupId>
688-
<artifactId>nexus-staging-maven-plugin</artifactId>
689-
<version>${nexus-staging-maven-plugin.version}</version>
682+
<groupId>org.sonatype.central</groupId>
683+
<artifactId>central-publishing-maven-plugin</artifactId>
684+
<version>${central-publishing-maven-plugin.version}</version>
690685
<extensions>true</extensions>
691686
<configuration>
692-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
693-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
694-
<serverId>ossrh</serverId>
695-
<stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
687+
<autoPublish>true</autoPublish>
688+
<publishingServerId>central</publishingServerId>
689+
<waitUntil>published</waitUntil>
696690
</configuration>
697691
</plugin>
698692
</plugins>

0 commit comments

Comments
 (0)