11# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
22# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
33
4+ # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
5+ # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
6+
47name : Maven Package
58
69on :
1013
1114jobs :
1215 build :
13-
1416 runs-on : ubuntu-latest
1517 permissions :
1618 contents : write
2426 with :
2527 java-version : ' 17'
2628 distribution : ' temurin'
27- server-id : github # Value of the distributionManagement/repository/id field of the pom.xml
28- settings-path : ${{ github.workspace }} # location for the settings.xml file
29+ server-id : github
30+ settings-path : ${{ github.workspace }}
31+
32+ - name : Set Maven Version
33+ run : mvn versions:set -DnewVersion=${{ github.ref_name }}
2934
3035 - name : Build with Maven
3136 run : mvn -B -U -DskipTests clean package --file pom.xml
@@ -39,15 +44,17 @@ jobs:
3944 draft : false
4045 prerelease : false
4146 env :
42- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43-
47+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48+
4449 - name : Upload JAR to Release
4550 uses : actions/upload-release-asset@v1
4651 with :
4752 upload_url : ${{ steps.create_release.outputs.upload_url }}
48- asset_path : target/python-generator-0.0.0.main-SNAPSHOT .jar
53+ asset_path : target/python-generator-${{ github.ref_name }} .jar
4954 asset_name : python-generator-${{ github.ref_name }}.jar
5055 asset_content_type : application/java-archive
5156 env :
52- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53-
57+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58+
59+ - name : Reset POM
60+ run : git checkout -- pom.xml
0 commit comments