Skip to content

Commit cc4d7b1

Browse files
committed
Enable snapshot publishing
1 parent d470b0d commit cc4d7b1

File tree

2 files changed

+40
-15
lines changed

2 files changed

+40
-15
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99

1010
jobs:
1111

12-
java-21:
12+
java:
1313

1414
name: Java 21 (${{ matrix.os }})
1515
strategy:
@@ -35,6 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38+
# https://jdk.java.net/
3839
java: [24, 25, 26]
3940
runs-on: ubuntu-latest
4041

@@ -64,3 +65,29 @@ jobs:
6465
cache: maven
6566
- name: Generate Javadoc
6667
run: ./mvnw $MAVEN_ARGS compile javadoc:javadoc
68+
69+
publish-snapshot:
70+
71+
name: Publish Snapshot
72+
needs: [java, javadoc]
73+
runs-on: ubuntu-latest
74+
if: github.repository_owner == 'assertj' && github.event_name == 'push' && github.ref == 'refs/heads/main'
75+
76+
steps:
77+
- uses: actions/checkout@v5
78+
- name: Set up Maven Central
79+
uses: actions/setup-java@v5
80+
with:
81+
distribution: 'zulu'
82+
java-version: '21'
83+
server-id: central
84+
server-username: MAVEN_CENTRAL_USERNAME
85+
server-password: MAVEN_CENTRAL_TOKEN
86+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
87+
88+
- name: Publish to Maven Central
89+
run: ./mvnw $MAVEN_ARGS -DskipTests -Ppublish deploy
90+
env:
91+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
92+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
93+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

pom.xml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,10 @@
3737
<url>https://github.com/assertj/assertj-eclipse-collections</url>
3838
</scm>
3939

40-
<repositories>
41-
<repository>
42-
<id>central-portal-snapshots</id>
43-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
44-
<releases>
45-
<enabled>false</enabled>
46-
</releases>
47-
</repository>
48-
</repositories>
49-
5040
<properties>
5141
<assertj.version>4.0.0-SNAPSHOT</assertj.version>
5242
<java.version>17</java.version>
5343
<eclipse-collections.version>13.0.0</eclipse-collections.version>
54-
<!-- Dependency versions overriding -->
55-
<junit-jupiter.version>5.12.1</junit-jupiter.version>
5644
</properties>
5745

5846
<dependencies>
@@ -83,6 +71,16 @@
8371
</dependency>
8472
</dependencies>
8573

74+
<repositories>
75+
<repository>
76+
<id>central-portal-snapshots</id>
77+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
78+
<releases>
79+
<enabled>false</enabled>
80+
</releases>
81+
</repository>
82+
</repositories>
83+
8684
<build>
8785
<pluginManagement>
8886
<plugins>
@@ -129,8 +127,8 @@
129127
</executions>
130128
</plugin>
131129
<plugin>
132-
<groupId>org.sonatype.plugins</groupId>
133-
<artifactId>nexus-staging-maven-plugin</artifactId>
130+
<groupId>org.sonatype.central</groupId>
131+
<artifactId>central-publishing-maven-plugin</artifactId>
134132
</plugin>
135133
</plugins>
136134
</build>

0 commit comments

Comments
 (0)