1212
1313 runs-on : ubuntu-latest
1414
15+ env :
16+ artifact_name : jpt
17+
1518 steps :
1619 - uses : actions/checkout@v2
1720 - name : Set up JDK 1.8
@@ -21,15 +24,58 @@ jobs:
2124 server-id : github # Value of the distributionManagement/repository/id field of the pom.xml
2225 settings-path : ${{ github.workspace }} # location for the settings.xml file
2326
27+ - name : Get the release version
28+ id : get_version
29+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
30+
2431 - name : Build with Maven
2532 run : mvn -B package --file pom.xml -s ${{ github.workspace }}/settings.xml
2633 env :
2734 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2835
29- - name : Update version
30- run : mvn versions:set -DnewVersion=${GITHUB_REF:11 }
36+ - name : Update package version
37+ run : mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION } }
3138
3239 - name : Publish to GitHub Packages Apache Maven
3340 run : mvn deploy -s ${{ github.workspace }}/settings.xml
3441 env :
3542 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+
44+ - name : Get the upload URL for a release
45+ id : get
46+ uses :
bruceadams/[email protected] 47+ env :
48+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49+
50+ - name : Upload Release Asset jar
51+ id : upload-release-asset-jar
52+ 53+ env :
54+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55+ with :
56+ upload_url : ${{ steps.get.outputs.upload_url }}
57+ asset_path : dist/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}.jar
58+ asset_name : ${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}.jar
59+ asset_content_type : application/java-archive
60+
61+ - name : Upload Release Asset sources
62+ id : upload-release-asset-src
63+ 64+ env :
65+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
66+ with :
67+ upload_url : ${{ steps.get.outputs.upload_url }}
68+ asset_path : dist/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-sources.jar
69+ asset_name : ${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-sources.jar
70+ asset_content_type : application/java-archive
71+
72+ - name : Upload Release Asset docs
73+ id : upload-release-asset-docs
74+ 75+ env :
76+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
77+ with :
78+ upload_url : ${{ steps.get.outputs.upload_url }}
79+ asset_path : dist/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-javadoc.jar
80+ asset_name : ${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-javadoc.jar
81+ asset_content_type : application/java-archive
0 commit comments