File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change 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
5+
6+ on :
7+ push :
8+ branches :
9+ - master
10+
11+ jobs :
12+ build :
13+
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : write
17+ packages : write
18+
19+ steps :
20+ - uses : actions/checkout@v3
21+ - name : Set up JDK 8
22+ uses : actions/setup-java@v2
23+ with :
24+ java-version : ' 8'
25+ distribution : ' temurin'
26+ server-id : github
27+
28+ - name : Increment the version number
29+ id : incVer
30+ run : |
31+ mvn validate -DincrementBuild
32+ mvn versions:commit
33+ APPLICATION_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
34+ git config user.name github-actions
35+ git config user.email github-actions@github.com
36+ git add pom.xml
37+ git commit -m "[skip ci]"
38+ git tag -a v$APPLICATION_VERSION -m "Release v$APPLICATION_VERSION"
39+ echo "::set-output name=application_version::v$APPLICATION_VERSION"
40+ - name : Push changes
41+ uses : ad-m/github-push-action@master
42+ with :
43+ github_token : ${{ secrets.GITHUB_TOKEN }}
44+ branch : ${{ github.ref }}
45+ tags : true
46+
47+ - name : Build with Maven
48+ run : mvn --batch-mode clean compile package
49+
50+ - name : Create release
51+ uses : softprops/action-gh-release@v1
52+ with :
53+ name : ${{ steps.incVer.outputs.application_version }}
54+ files : target/*.jar
55+ tag_name : refs/tags/${{ steps.incVer.outputs.application_version }}
56+
57+ - name : Publish package
58+ run : mvn --batch-mode deploy
59+ env :
60+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61+
You can’t perform that action at this time.
0 commit comments