Skip to content

Commit 5c6167f

Browse files
committed
configuring central sonatype release
1 parent a431d8e commit 5c6167f

File tree

5 files changed

+86
-38
lines changed

5 files changed

+86
-38
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
name: Build & Test
22

33
on:
4-
push:
5-
branches: [ "master" ]
64
pull_request:
75
branches: [ "master" ]
86
workflow_dispatch:
97

8+
permissions:
9+
contents: read
10+
checks: write # Required for uploading test results
11+
pull-requests: write # Required for PR comments
12+
security-events: write # Required for CodeQL
13+
actions: read # Required for checking workflow runs
14+
statuses: write # Required for Codecov status updates
15+
1016
jobs:
1117
build:
1218
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Release
22

33
on:
4+
workflow_dispatch:
45
push:
56
tags:
67
- 'v?[0-9]+.[0-9]+.[0-9]'
@@ -18,15 +19,15 @@ jobs:
1819
steps:
1920
- uses: actions/checkout@v4
2021
with:
21-
fetch-depth: 0 # Required for getting tag information
22+
fetch-depth: 0
2223

2324
- name: Set up JDK
2425
uses: actions/setup-java@v4
2526
with:
2627
java-version: '8'
2728
distribution: 'temurin'
2829
cache: 'maven'
29-
server-id: ossrh
30+
server-id: central
3031
server-username: MAVEN_USERNAME
3132
server-password: MAVEN_PASSWORD
3233
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
@@ -35,23 +36,35 @@ jobs:
3536
run: |
3637
VERSION=${GITHUB_REF#refs/tags/}
3738
echo "Setting version to $VERSION"
38-
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false
39+
mvn -B versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false | awk '/svaningelgem/ || !/Downloading|Downloaded|Progress/'
3940
40-
- name: Build and Deploy to OSSRH
41+
- name: Building
4142
run: |
42-
mvn -B clean deploy -pl jacoco-console-reporter -am -P release
43+
set -o pipefail
44+
mvn -B clean install | awk '/svaningelgem/ || !/Downloading|Downloaded|Progress/'
45+
46+
- name: Flatten pom.xml file
47+
run: |
48+
set -o pipefail
49+
mvn -B flatten:flatten | awk '/svaningelgem/ || !/Downloading|Downloaded|Progress/'
50+
51+
- name: Deploying to Central
52+
run: |
53+
set -o pipefail
54+
mvn -B deploy -pl jacoco-console-reporter -am -P release -DskipTests | awk '/svaningelgem/ || !/Downloading|Downloaded|Progress/'
4355
env:
44-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
45-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
56+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
57+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
58+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
4659

4760
- name: Create GitHub Release
4861
uses: softprops/action-gh-release@v2
4962
with:
5063
files: |
5164
jacoco-console-reporter/target/*.jar
52-
!jacoco-console-reporter/target/*-sources.jar
53-
!jacoco-console-reporter/target/*-javadoc.jar
5465
generate_release_notes: true
55-
tag_name: ${{ github.ref_name }} # Use the tag name for the release
66+
make_latest: true
67+
fail_on_unmatched_files: false
68+
tag_name: ${{ github.ref_name }}
5669
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ replay_pid*
2828
.idea/
2929
target/
3030
build/
31+
.flattened-pom.xml

jacoco-console-reporter/pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@
101101
<artifactId>maven-compiler-plugin</artifactId>
102102
</plugin>
103103

104+
<!-- CI -->
105+
<plugin>
106+
<groupId>org.codehaus.mojo</groupId>
107+
<artifactId>flatten-maven-plugin</artifactId>
108+
</plugin>
109+
104110
<!-- Plugin Development -->
105111
<plugin>
106112
<groupId>org.apache.maven.plugins</groupId>
@@ -140,8 +146,8 @@
140146
<artifactId>maven-gpg-plugin</artifactId>
141147
</plugin>
142148
<plugin>
143-
<groupId>org.sonatype.plugins</groupId>
144-
<artifactId>nexus-staging-maven-plugin</artifactId>
149+
<groupId>org.sonatype.central</groupId>
150+
<artifactId>central-publishing-maven-plugin</artifactId>
145151
</plugin>
146152
</plugins>
147153
</build>

pom.xml

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,16 @@
2929
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
3030
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
3131
<!-- Added properties for deployment -->
32-
<gpg.keyname>your-gpg-key-id</gpg.keyname>
33-
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
32+
<gpg.keyname>Steven Van Ingelgem</gpg.keyname>
33+
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
3434
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
3535
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
3636
<maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
3737
<lombok.version>1.18.36</lombok.version>
3838
<jline.version>3.29.0</jline.version>
39+
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
3940
</properties>
4041

41-
<!-- Distribution Management -->
42-
<distributionManagement>
43-
<snapshotRepository>
44-
<id>ossrh</id>
45-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
46-
</snapshotRepository>
47-
<repository>
48-
<id>ossrh</id>
49-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
50-
</repository>
51-
</distributionManagement>
52-
5342
<dependencyManagement>
5443
<dependencies>
5544
<!-- Maven Plugin Dependencies -->
@@ -282,24 +271,57 @@
282271
<goal>sign</goal>
283272
</goals>
284273
<configuration>
274+
<!--
285275
<keyname>${gpg.keyname}</keyname>
286276
<passphraseServerId>${gpg.keyname}</passphraseServerId>
277+
-->
278+
<gpgArguments>
279+
<arg>--pinentry-mode</arg>
280+
<arg>loopback</arg>
281+
</gpgArguments>
287282
</configuration>
288283
</execution>
289284
</executions>
290285
</plugin>
291286

292-
<!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
287+
<!-- https://mvnrepository.com/artifact/org.sonatype.central/central-publishing-maven-plugin -->
293288
<plugin>
294-
<groupId>org.sonatype.plugins</groupId>
295-
<artifactId>nexus-staging-maven-plugin</artifactId>
296-
<version>${nexus-staging-maven-plugin.version}</version>
289+
<groupId>org.sonatype.central</groupId>
290+
<artifactId>central-publishing-maven-plugin</artifactId>
291+
<version>${central-publishing-maven-plugin.version}</version>
297292
<extensions>true</extensions>
298293
<configuration>
299-
<serverId>ossrh</serverId>
300-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
301-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
294+
<publishingServerId>central</publishingServerId>
295+
<autoPublish>true</autoPublish>
296+
<excludeArtifacts>test-project,jacoco-console-reporter-parent</excludeArtifacts>
297+
</configuration>
298+
</plugin>
299+
300+
<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/flatten-maven-plugin -->
301+
<plugin>
302+
<groupId>org.codehaus.mojo</groupId>
303+
<artifactId>flatten-maven-plugin</artifactId>
304+
<version>${flatten-maven-plugin.version}</version>
305+
<configuration>
306+
<updatePomFile>true</updatePomFile>
307+
<flattenMode>ossrh</flattenMode>
302308
</configuration>
309+
<executions>
310+
<execution>
311+
<id>flatten</id>
312+
<phase>process-resources</phase>
313+
<goals>
314+
<goal>flatten</goal>
315+
</goals>
316+
</execution>
317+
<execution>
318+
<id>flatten.clean</id>
319+
<phase>clean</phase>
320+
<goals>
321+
<goal>clean</goal>
322+
</goals>
323+
</execution>
324+
</executions>
303325
</plugin>
304326
</plugins>
305327
</pluginManagement>
@@ -323,8 +345,8 @@
323345
<artifactId>maven-gpg-plugin</artifactId>
324346
</plugin>
325347
<plugin>
326-
<groupId>org.sonatype.plugins</groupId>
327-
<artifactId>nexus-staging-maven-plugin</artifactId>
348+
<groupId>org.sonatype.central</groupId>
349+
<artifactId>central-publishing-maven-plugin</artifactId>
328350
</plugin>
329351
</plugins>
330352
</build>

0 commit comments

Comments
 (0)