@@ -17,27 +17,45 @@ jobs:
1717
1818 steps :
1919 - uses : actions/checkout@v2
20- - name : Set up JDK 1.8
21- uses : actions/setup-java@v1
22- with :
23- java-version : 1.8
24- server-id : github # Value of the distributionManagement/repository/id field of the pom.xml
25- settings-path : ${{ github.workspace }} # location for the settings.xml file
2620
2721 - name : Get the release version
2822 id : get_version
2923 run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
3024
25+ - name : Set up JDK 1.8 for deploy to OSSRH
26+ uses : actions/setup-java@v1
27+ with :
28+ java-version : 1.8
29+ server-id : ossrh
30+ server-username : MAVEN_USERNAME
31+ server-password : MAVEN_CENTRAL_TOKEN
32+ gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
33+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
34+
3135 - name : Build with Maven
32- run : mvn -B package --file pom.xml -s ${{ github.workspace }}/settings.xml
36+ run : mvn -B package --file pom.xml
37+
38+ - name : Update package version
39+ run : mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
40+
41+ - name : Publish to Apache Maven Central
42+ run : mvn deploy
3343 env :
34- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44+ MAVEN_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
45+ MAVEN_CENTRAL_TOKEN : ${{ secrets.MAVEN_CENTRAL_TOKEN }}
46+ MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
47+
48+ - name : Set up JDK 1.8 for deploy to github packages
49+ uses : actions/setup-java@v1
50+ with :
51+ java-version : 1.8
52+ server-id : github
3553
3654 - name : Update package version
3755 run : mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
3856
3957 - name : Publish to GitHub Packages Apache Maven
40- run : mvn deploy -s ${{ github.workspace }}/settings.xml
58+ run : mvn deploy
4159 env :
4260 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4361
0 commit comments