Skip to content

Commit c26fbf9

Browse files
committed
Add publishing to maven central
1 parent e50ac7b commit c26fbf9

File tree

4 files changed

+107
-3
lines changed

4 files changed

+107
-3
lines changed

.github/settings.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<settings>
2+
<servers>
3+
<server>
4+
<id>central</id>
5+
<username>${env.OSSRH_USERNAME}</username>
6+
<password>${env.OSSRH_PASSWORD}</password>
7+
</server>
8+
</servers>
9+
<profiles>
10+
<profile>
11+
<id>ossrh</id>
12+
<activation>
13+
<activeByDefault>true</activeByDefault>
14+
</activation>
15+
<properties>
16+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
17+
</properties>
18+
</profile>
19+
</profiles>
20+
<activeProfiles>
21+
<activeProfile>release</activeProfile>
22+
</activeProfiles>
23+
</settings>

.github/workflows/deploy.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Deploy to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up JDK 11
14+
uses: actions/setup-java@v3
15+
with:
16+
java-version: '11'
17+
distribution: 'temurin'
18+
cache: maven
19+
- name: Build and Deploy
20+
env:
21+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
22+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
23+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
24+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
25+
run: |
26+
echo $GPG_PRIVATE_KEY | base64 --decode | gpg --import
27+
mvn clean deploy -P release --settings .github/settings.xml

.github/workflows/maven.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
1211
runs-on: ubuntu-latest
13-
1412
steps:
1513
- uses: actions/checkout@v4
1614
- name: Set up JDK 11

pom.xml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@
2020
RegexSolver allows you to manipulate regular expressions as sets, enabling operations such as intersection,
2121
union, and subtraction.
2222
</description>
23+
<developers>
24+
<developer>
25+
<name>Alexandre van Beurden</name>
26+
</developer>
27+
</developers>
28+
29+
<licenses>
30+
<license>
31+
<name>MIT License</name>
32+
<url>https://opensource.org/licenses/MIT</url>
33+
<distribution>repo</distribution>
34+
</license>
35+
</licenses>
2336

2437
<properties>
2538
<maven.compiler.source>11</maven.compiler.source>
@@ -53,6 +66,19 @@
5366
</dependencies>
5467
<build>
5568
<plugins>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-source-plugin</artifactId>
72+
<version>3.3.1</version>
73+
<executions>
74+
<execution>
75+
<id>attach-sources</id>
76+
<goals>
77+
<goal>jar-no-fork</goal>
78+
</goals>
79+
</execution>
80+
</executions>
81+
</plugin>
5682
<plugin>
5783
<groupId>org.apache.maven.plugins</groupId>
5884
<artifactId>maven-javadoc-plugin</artifactId>
@@ -64,12 +90,42 @@
6490
</configuration>
6591
<executions>
6692
<execution>
93+
<id>attach-javadocs</id>
6794
<goals>
68-
<goal>javadoc</goal>
95+
<goal>jar</goal>
6996
</goals>
7097
</execution>
7198
</executions>
7299
</plugin>
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-gpg-plugin</artifactId>
103+
<version>1.5</version>
104+
<executions>
105+
<execution>
106+
<id>sign-artifacts</id>
107+
<phase>verify</phase>
108+
<goals>
109+
<goal>sign</goal>
110+
</goals>
111+
<configuration>
112+
<gpgArguments>
113+
<arg>--pinentry-mode</arg>
114+
<arg>loopback</arg>
115+
</gpgArguments>
116+
</configuration>
117+
</execution>
118+
</executions>
119+
</plugin>
120+
<plugin>
121+
<groupId>org.sonatype.central</groupId>
122+
<artifactId>central-publishing-maven-plugin</artifactId>
123+
<version>0.5.0</version>
124+
<extensions>true</extensions>
125+
<configuration>
126+
<publishingServerId>central</publishingServerId>
127+
</configuration>
128+
</plugin>
73129
</plugins>
74130
</build>
75131
</project>

0 commit comments

Comments
 (0)