Skip to content

Commit 58e333a

Browse files
committed
publish snapshots to Maven Central
1 parent 813399b commit 58e333a

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: DDI PDF Snapshot to Maven Central Repository
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "ddi-pdf/**"
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
- "ddi-pdf/**"
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
if: ${{ !contains(github.event.head_commit.message, '[maven-release-plugin]') }}
17+
strategy:
18+
matrix:
19+
java: [17]
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Maven Central Repository
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: ${{ matrix.java }}
26+
distribution: 'adopt'
27+
server-id: ossrh
28+
server-username: MAVEN_USERNAME
29+
server-password: MAVEN_PASSWORD
30+
- name: Cache Maven packages
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.m2
34+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
35+
restore-keys: ${{ runner.os }}-m2
36+
- name: Build, test, verify and publish snapshot
37+
run: mvn -f ddi-pdf -B verify -Djdk.version=${{ matrix.java }}
38+
- name: Publish snapshot
39+
if: ${{ matrix.java == '17' }}
40+
run: mvn -f ddi-pdf deploy -DskipAnalysis -DskipUT -DskipIT -Djdk.version=${{ matrix.java }}
41+
env:
42+
MAVEN_USERNAME: ${{ secrets.DATAVERSEBOT_SONATYPE_USERNAME }}
43+
MAVEN_PASSWORD: ${{ secrets.DATAVERSEBOT_SONATYPE_TOKEN }}

ddi-pdf/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@
5151
<scope>test</scope>
5252
</dependency>
5353
</dependencies>
54+
<distributionManagement>
55+
<snapshotRepository>
56+
<id>ossrh</id>
57+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
58+
</snapshotRepository>
59+
<repository>
60+
<id>ossrh</id>
61+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
62+
</repository>
63+
</distributionManagement>
5464
<build>
5565
<plugins>
5666
<plugin>
@@ -59,6 +69,17 @@
5969
<release>17</release>
6070
</configuration>
6171
</plugin>
72+
<plugin>
73+
<groupId>org.sonatype.plugins</groupId>
74+
<artifactId>nexus-staging-maven-plugin</artifactId>
75+
<version>1.6.13</version>
76+
<extensions>true</extensions>
77+
<configuration>
78+
<serverId>ossrh</serverId>
79+
<nexusUrl>https://s01.oss.sonatype.org</nexusUrl>
80+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
81+
</configuration>
82+
</plugin>
6283
</plugins>
6384
</build>
6485

0 commit comments

Comments
 (0)