Skip to content

Commit 5efd98b

Browse files
authored
Migrate to the Central Publisher Portal, enable snapshot publishing (#273)
1 parent 0d145e5 commit 5efd98b

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,29 @@ jobs:
6363
env:
6464
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6565
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
66+
67+
publish-snapshot:
68+
69+
name: Publish Snapshot
70+
needs: [test, javadoc]
71+
runs-on: ubuntu-latest
72+
if: github.repository_owner == 'assertj' && github.event_name == 'push' && github.ref == 'refs/heads/main'
73+
74+
steps:
75+
- uses: actions/checkout@v4
76+
- name: Set up Maven Central
77+
uses: actions/setup-java@v4
78+
with:
79+
distribution: 'zulu'
80+
java-version: '21'
81+
server-id: central
82+
server-username: MAVEN_CENTRAL_USERNAME
83+
server-password: MAVEN_CENTRAL_TOKEN
84+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
85+
86+
- name: Publish to Maven Central
87+
run: ./mvnw $MAVEN_ARGS -DskipTests -Ppublish deploy
88+
env:
89+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
90+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
91+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/release.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ env:
77
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always -Djacoco.skip=true
88

99
jobs:
10-
release:
1110

12-
name: Release to Maven Central
11+
publish-release:
12+
13+
name: Publish Release
1314
runs-on: ubuntu-latest
1415

1516
steps:
@@ -20,8 +21,8 @@ jobs:
2021
distribution: 'zulu'
2122
java-version: '21'
2223
server-id: ossrh
23-
server-username: OSSRH_USERNAME
24-
server-password: OSSRH_TOKEN
24+
server-username: MAVEN_CENTRAL_USERNAME
25+
server-password: MAVEN_CENTRAL_TOKEN
2526
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
2627

2728
- name: Publish to Maven Central
@@ -30,6 +31,6 @@ jobs:
3031
git config user.email '${{ github.actor }}@users.noreply.github.com'
3132
./mvnw $MAVEN_ARGS release:prepare release:perform -Dpassword=${{ secrets.GITHUB_TOKEN }}
3233
env:
33-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
34-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
34+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
35+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
3536
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

assertj-generator/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.assertj</groupId>
77
<artifactId>assertj-generator-build</artifactId>
8-
<version>3.0.0-M6-SNAPSHOT</version>
8+
<version>3.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>assertj-generator</artifactId>
@@ -17,8 +17,6 @@
1717
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1818
<!-- Needed to properly bring in the Maven dependencies, see http://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html -->
1919
<surefire.useSystemClassLoader>false</surefire.useSystemClassLoader>
20-
<!-- Dependency versions overriding -->
21-
<junit-jupiter.version>5.11.1</junit-jupiter.version>
2220
</properties>
2321

2422
<dependencyManagement>

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010

1111
<artifactId>assertj-generator-build</artifactId>
12-
<version>3.0.0-M6-SNAPSHOT</version>
12+
<version>3.0.0-SNAPSHOT</version>
1313
<packaging>pom</packaging>
1414

1515
<name>AssertJ Generator Build</name>
@@ -32,8 +32,8 @@
3232
<build>
3333
<plugins>
3434
<plugin>
35-
<groupId>org.sonatype.plugins</groupId>
36-
<artifactId>nexus-staging-maven-plugin</artifactId>
35+
<groupId>org.sonatype.central</groupId>
36+
<artifactId>central-publishing-maven-plugin</artifactId>
3737
</plugin>
3838
</plugins>
3939
</build>

0 commit comments

Comments
 (0)