Skip to content

Commit 3735fe8

Browse files
committed
Improve GitHub actions
1 parent ba246a0 commit 3735fe8

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed
Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3-
4-
name: Maven Package
1+
name: Publish package to the Maven Central Repository
52

63
on:
74
release:
85
types: [created]
96

107
jobs:
11-
build:
12-
8+
publish:
139
runs-on: ubuntu-latest
14-
permissions:
15-
contents: read
16-
packages: write
17-
1810
steps:
1911
- uses: actions/checkout@v4
20-
- name: Set up JDK 11
21-
uses: actions/setup-java@v3
12+
- name: Set up Maven Central Repository
13+
uses: actions/setup-java@v4
2214
with:
23-
java-version: '11'
15+
java-version: '8'
2416
distribution: 'temurin'
25-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26-
settings-path: ${{ github.workspace }} # location for the settings.xml file
27-
28-
- name: Build with Maven
29-
run: mvn -B package --file pom.xml
30-
31-
- name: Publish to GitHub Packages Apache Maven
32-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
17+
server-id: ossrh
18+
server-username: MAVEN_USERNAME
19+
server-password: MAVEN_PASSWORD
20+
- name: Publish package
21+
run: mvn --batch-mode deploy
3322
env:
34-
GITHUB_TOKEN: ${{ github.token }}
23+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
24+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

.github/workflows/maven.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v4
24-
- name: Set up JDK 17
24+
- name: Set up JDK 8
2525
uses: actions/setup-java@v3
2626
with:
27-
java-version: '17'
27+
java-version: '8'
2828
distribution: 'temurin'
2929
cache: maven
3030
- name: Build with Maven

pom.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<version>1.0.0-SNAPSHOT</version>
99

1010
<properties>
11-
<maven.compiler.source>17</maven.compiler.source>
12-
<maven.compiler.target>17</maven.compiler.target>
11+
<maven.compiler.source>8</maven.compiler.source>
12+
<maven.compiler.target>8</maven.compiler.target>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1414
</properties>
1515

@@ -52,4 +52,12 @@
5252
</plugins>
5353
</build>
5454

55+
<distributionManagement>
56+
<repository>
57+
<id>ossrh</id>
58+
<name>Central Repository OSSRH</name>
59+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
60+
</repository>
61+
</distributionManagement>
62+
5563
</project>

0 commit comments

Comments
 (0)