Skip to content

Commit a6702e4

Browse files
committed
Update release workflow and improve documentation publishing
1 parent 119e965 commit a6702e4

5 files changed

Lines changed: 82 additions & 59 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ name: Java CI with Maven
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
8+
branches:
9+
- main
810

911
jobs:
1012
build:
@@ -21,10 +23,44 @@ jobs:
2123
distribution: 'temurin'
2224
cache: maven
2325
- run: mvn -B verify
26+
- uses: dorny/test-reporter@v3
27+
if: always()
28+
with:
29+
name: JUnit Tests
30+
path: '**/target/surefire-reports/TEST-*.xml'
31+
reporter: java-junit
32+
fail-on-error: false
2433
- uses: madrapps/jacoco-report@v1.7.2
2534
with:
2635
paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml
2736
token: ${{ secrets.GITHUB_TOKEN }}
2837
min-coverage-overall: 80
2938
min-coverage-changed-files: 80
30-
- uses: scacap/action-surefire-report@v1.9.1
39+
- uses: actions/configure-pages@v6
40+
if: github.ref == 'refs/heads/main'
41+
- uses: actions/jekyll-build-pages@v1
42+
if: github.ref == 'refs/heads/main'
43+
with:
44+
destination: ./page
45+
- if: github.ref == 'refs/heads/main'
46+
run: |
47+
mkdir -p _site/apidocs _site/coverage
48+
cp -r page/. _site/
49+
cp -r target/reports/apidocs/. _site/apidocs/
50+
cp -r target/site/jacoco/. _site/coverage/
51+
- uses: actions/upload-pages-artifact@v5
52+
if: github.ref == 'refs/heads/main'
53+
54+
publish-docs:
55+
needs: build
56+
if: github.ref == 'refs/heads/main'
57+
runs-on: ubuntu-latest
58+
permissions:
59+
pages: write
60+
id-token: write
61+
environment:
62+
name: github-pages
63+
url: ${{ steps.deploy.outputs.page_url }}
64+
steps:
65+
- id: deploy
66+
uses: actions/deploy-pages@v4

.github/workflows/gh-pages.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- reopened
11+
- synchronize
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
update_release_draft:
18+
if: github.event_name == 'push'
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: read
23+
steps:
24+
- uses: release-drafter/release-drafter@v7
25+
26+
autolabel:
27+
if: github.event_name == 'pull_request'
28+
runs-on: ubuntu-latest
29+
permissions:
30+
pull-requests: write
31+
steps:
32+
- uses: release-drafter/release-drafter/autolabeler@v7

.github/workflows/release.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,22 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v6
9-
with:
10-
token: ${{ secrets.RELEASE_PAT }}
11-
persist-credentials: true
129
- uses: actions/setup-java@v5
1310
with:
1411
java-version: '17'
1512
distribution: 'temurin'
1613
cache: maven
17-
server-id: ossrh
14+
server-id: central
1815
server-username: OSSRH_USERNAME
1916
server-password: OSSRH_PASSWORD
2017
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
2118
gpg-passphrase: GPG_PASSPHRASE
22-
- run: |
23-
git config user.email "matomo-java-tracker@daniel-heid.de"
24-
git config user.name "Matomo Java Tracker"
2519
- id: version
2620
run: |
2721
VERSION=$( mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout )
2822
echo "version=${VERSION%-SNAPSHOT}" >> "$GITHUB_OUTPUT"
29-
- run: mvn -B release:prepare release:perform
23+
- run: mvn -B versions:set -DnewVersion=${{ steps.version.outputs.version }} -DgenerateBackupPoms=false
24+
- run: mvn -B deploy -Prelease
3025
env:
3126
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3227
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
@@ -35,5 +30,3 @@ jobs:
3530
with:
3631
version: ${{ steps.version.outputs.version }}
3732
publish: true
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,9 @@
5757

5858
<distributionManagement>
5959
<repository>
60-
<id>ossrh</id>
61-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
60+
<id>central</id>
61+
<url>https://central.sonatype.com/</url>
6262
</repository>
63-
<snapshotRepository>
64-
<id>ossrh</id>
65-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
66-
</snapshotRepository>
6763
</distributionManagement>
6864

6965
<properties>
@@ -197,14 +193,12 @@
197193
</executions>
198194
</plugin>
199195
<plugin>
200-
<groupId>org.sonatype.plugins</groupId>
201-
<artifactId>nexus-staging-maven-plugin</artifactId>
202-
<version>1.7.0</version>
196+
<groupId>org.sonatype.central</groupId>
197+
<artifactId>central-publishing-maven-plugin</artifactId>
198+
<version>0.10.0</version>
203199
<extensions>true</extensions>
204200
<configuration>
205-
<serverId>ossrh</serverId>
206-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
207-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
201+
<autoPublish>true</autoPublish>
208202
</configuration>
209203
</plugin>
210204
</plugins>
@@ -428,8 +422,8 @@
428422
<artifactId>maven-gpg-plugin</artifactId>
429423
</plugin>
430424
<plugin>
431-
<groupId>org.sonatype.plugins</groupId>
432-
<artifactId>nexus-staging-maven-plugin</artifactId>
425+
<groupId>org.sonatype.central</groupId>
426+
<artifactId>central-publishing-maven-plugin</artifactId>
433427
</plugin>
434428
</plugins>
435429
</build>

0 commit comments

Comments
 (0)