33# SPDX-License-Identifier: Apache-2.0
44
55# This workflow will publish a Java project with Gradle
6- # For gradle wrapper validation see: https://github.com/marketplace/actions/gradle-wrapper-validation
7- # For gradle build see: https://github.com/marketplace /actions/gradle-build-action
6+ # For maven build see: https://github.com/marketplace/actions/gradle-build-action
7+ # For maven publishing see: https://docs. github.com/en /actions/publishing-packages/publishing-java-packages-with-maven
88
99name : Publish Snapshot
1010
@@ -17,25 +17,20 @@ jobs:
1717 runs-on : ubuntu-22.04
1818 steps :
1919
20- - name : Checkout repository
21- uses : actions/checkout@v3
22- with :
23- fetch-depth : 0
24-
25- - name : Set up JDK 17
26- uses : actions/setup-java@v3
27- with :
28- java-version : 17
29- distribution : adopt
30-
31- - name : Validate Gradle wrapper
32- uses : gradle/wrapper-validation-action@v1.1.0
33-
34- - name : Setup Gradle
35- uses : gradle/gradle-build-action@v2.7.0
36-
37- - name : Publish to Maven Central
38- run : ./gradlew publish
39- env :
40- MAVEN_USERNAME : ${{ secrets.MAVEN_USERNAME }}
41- MAVEN_PASSWORD : ${{ secrets.MAVEN_PASSWORD }}
20+ - name : Checkout repository
21+ uses : actions/checkout@v3
22+
23+ - name : Set up JDK 17
24+ uses : actions/setup-java@v3
25+ with :
26+ java-version : 17
27+ distribution : temurin
28+ server-id : ossrh
29+ server-username : MAVEN_USERNAME
30+ server-password : MAVEN_PASSWORD
31+
32+ - name : Build & Publish to Maven Central
33+ run : mvn -U -B clean deploy # -U: force updates for dependencies, -B: no user input
34+ env :
35+ MAVEN_USERNAME : ${{ secrets.MAVEN_USERNAME }}
36+ MAVEN_PASSWORD : ${{ secrets.MAVEN_PASSWORD }}
0 commit comments