1- name : Publish jar
2- # Controls when the action will run.
1+ name : Publish compiled jar to GitHub releases
32on :
43 push :
54 branches : [ main ]
65jobs :
76 build :
87 runs-on : ubuntu-latest
98 steps :
10- - name : checkout
11- uses : actions/checkout@v1
12- - name : setup
13- uses : actions/setup-java@v1
14- with :
15- java-version : 1.8
16- - name : cache
17- uses : actions/cache@v1
18- with :
19- path : ~/.m2/repository
20- key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
21- restore-keys : |
22- ${{ runner.os }}-maven-
23- - name : build
24- run : mvn package
25- - name : artifact
26- uses : actions/upload-artifact@v1
27- with :
28- name : NitroCloudy-1.0.0-SNAPSHOT.jar
29- path : target/NitroCloudy-1.0.0-SNAPSHOT.jar
9+ - uses : actions/checkout@v2
10+ - uses : actions/setup-java@v1
11+ with :
12+ java-version : ' 8'
13+ - name : Build jar
14+ run : mvn package
15+ - name : artifact
16+ uses : actions/upload-artifact@v1
17+ with :
18+ name : NitroCloudy-1.0.0-SNAPSHOT.jar
19+ path : target/NitroCloudy-1.0.0-SNAPSHOT.jar
20+ - name : Move generated jar file
21+ run : mv target/NitroCloudy-1.0.0-SNAPSHOT.jar NitroCloudy-1.0.0-SNAPSHOT.jar
22+ - name : Create Release
23+ id : create_release
24+ if : github.event_name != 'pull_request' && (github.ref == 'refs/heads/main')
25+ uses : actions/create-release@v1
26+ env :
27+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28+ with :
29+ tag_name : NitroCloudy-${{github.sha}}
30+ release_name : Release ${{github.sha}}
31+ draft : false
32+ prerelease : false
33+ - name : Upload Release Asset
34+ id : upload-release-asset
35+ if : github.event_name != 'pull_request' && (github.ref == 'refs/heads/main')
36+ uses : actions/upload-release-asset@v1
37+ env :
38+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39+ with :
40+ upload_url : ${{ steps.create_release.outputs.upload_url }}
41+ asset_path : ./NitroCloudy-1.0.0-SNAPSHOT.jar
42+ asset_name : NitroCloudy-1.0.0-SNAPSHOT.jar
43+ asset_content_type : application/java-archive
0 commit comments