Skip to content

Commit 7eb3857

Browse files
committed
Enable snapshot publishing
1 parent af620de commit 7eb3857

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,31 @@ jobs:
8585
- name: Generate Javadoc
8686
run: ./mvnw $MAVEN_ARGS compile javadoc:javadoc
8787

88+
publish-snapshot:
89+
90+
name: Publish Snapshot
91+
needs: java
92+
runs-on: ubuntu-latest
93+
if: github.repository_owner == 'scordio' && github.event_name == 'push' && github.ref == 'refs/heads/main'
94+
95+
steps:
96+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
97+
- name: Set up Maven Central
98+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
99+
with:
100+
java-version: '25'
101+
distribution: 'zulu'
102+
103+
- name: Publish to Maven Central
104+
run: ./mvnw $MAVEN_ARGS -DskipTests -Ppublish deploy
105+
env:
106+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
108+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
109+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
110+
JRELEASER_NEXUS2_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }}
111+
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
112+
88113
build-user-guide:
89114

90115
name: Build User Guide

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
distribution: 'zulu'
2626

2727
- name: Publish to Maven Central
28-
run: ./mvnw $MAVEN_ARGS -Prelease deploy
28+
run: ./mvnw $MAVEN_ARGS -Ppublish deploy
2929
env:
30-
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
31-
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }}
30+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3231
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
3332
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
3433
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
35-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }}
35+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}

pom.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259

260260
<profiles>
261261
<profile>
262-
<id>release</id>
262+
<id>publish</id>
263263
<properties>
264264
<altDeploymentRepository>local::file:./target/staging-deploy</altDeploymentRepository>
265265
</properties>
@@ -308,11 +308,22 @@
308308
<maven>
309309
<mavenCentral>
310310
<sonatype>
311-
<active>ALWAYS</active>
311+
<active>RELEASE</active>
312312
<url>https://central.sonatype.com/api/v1/publisher</url>
313313
<stagingRepositories>target/staging-deploy</stagingRepositories>
314314
</sonatype>
315315
</mavenCentral>
316+
<nexus2>
317+
<sonatype-snapshot>
318+
<active>SNAPSHOT</active>
319+
<snapshotUrl>https://central.sonatype.com/repository/maven-snapshots/</snapshotUrl>
320+
<applyMavenCentralRules>true</applyMavenCentralRules>
321+
<snapshotSupported>true</snapshotSupported>
322+
<closeRepository>true</closeRepository>
323+
<releaseRepository>true</releaseRepository>
324+
<stagingRepositories>target/staging-deploy</stagingRepositories>
325+
</sonatype-snapshot>
326+
</nexus2>
316327
</maven>
317328
</deploy>
318329
</jreleaser>

0 commit comments

Comments
 (0)