1+
2+ # This is a basic workflow to help you get started with Actions
3+
4+ name : Create Releases
5+
6+ # Controls when the action will run. Triggers the workflow on push or pull request
7+ # events but only for the master branch
8+ on :
9+ push :
10+ branches : [ master ]
11+ pull_request :
12+ branches : [ master ]
13+
14+ jobs :
15+ create-main-release :
16+ if : " startsWith(github.event.commits[0].message, 'v') && !contains(github.event.commits[0].message, '-SNAPSHOT')"
17+ name : Create Release
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : Checkout code
21+ uses : actions/checkout@v2
22+ - name : Set up JDK 1.8
23+ uses : actions/setup-java@v1
24+ with :
25+ java-version : 1.8
26+ - name : Cache Maven Packages
27+ uses : actions/cache@v1
28+ with :
29+ path : ~/.m2
30+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
31+ restore-keys : ${{ runner.os }}-m2
32+ - name : Build with Maven
33+ run : mvn clean install
34+ - name : Archive jar
35+ run : mkdir staging && cp target/*.jar staging
36+ - name : upload jar
37+ uses : actions/upload-artifact@v1
38+ with :
39+ name : ARTIFACT_NAME ${{ github.event.commits[0].message }}
40+ path : staging
41+ - name : Create Release
42+ id : create_release
43+ uses : actions/create-release@v1
44+ env :
45+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46+ with :
47+ tag_name : ${{ github.event.commits[0].message }}
48+ release_name : JDAExtended ${{ github.event.commits[0].message }}
49+ body : ${{ github.event.commits[0].message }}
50+ draft : false
51+ prerelease : false
52+ - name : Upload Release Asset
53+ id : upload-release-asset
54+ uses : actions/upload-release-asset@v1
55+ env :
56+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57+ with :
58+ upload_url : ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
59+ asset_path : staging/ARTIFACT_NAME.jar
60+ asset_name : ARTIFACT_NAME.jar
61+ asset_content_type : application/java-archive
62+ create-pre-release :
63+ if : " startsWith(github.event.commits[0].message, 'v') && contains(github.event.commits[0].message, '-SNAPSHOT')"
64+ name : Create Pre Release
65+ runs-on : ubuntu-latest
66+ steps :
67+ - name : Checkout code
68+ uses : actions/checkout@v2
69+ - name : Set up JDK 1.8
70+ uses : actions/setup-java@v1
71+ with :
72+ java-version : 1.8
73+ - name : Cache Maven Packages
74+ uses : actions/cache@v1
75+ with :
76+ path : ~/.m2
77+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
78+ restore-keys : ${{ runner.os }}-m2
79+ - name : Build with Maven
80+ run : mvn clean install
81+ - name : Archive jar
82+ run : mkdir staging && cp target/*.jar staging
83+ - name : upload jar
84+ uses : actions/upload-artifact@v1
85+ with :
86+ name : ARTIFACT_NAME ${{ github.event.commits[0].message }}
87+ path : staging
88+ - name : Create Release
89+ id : create_release
90+ uses : actions/create-release@v1
91+ env :
92+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
93+ with :
94+ tag_name : ${{ github.event.commits[0].message }}
95+ release_name : ARTIFACT_NAME ${{ github.event.commits[0].message }}
96+ body : ${{ github.event.commits[0].message }}
97+ draft : false
98+ prerelease : true
99+ - name : Upload Release Asset
100+ id : upload-release-asset
101+ uses : actions/upload-release-asset@v1
102+ env :
103+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104+ with :
105+ upload_url : ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
106+ asset_path : staging/ARTIFACT_NAME.jar
107+ asset_name : ARTIFACT_NAME.jar
108+ asset_content_type : application/java-archive
109+ main :
110+ if : " !startsWith(github.event.commits[0].message, 'v')"
111+ name : Create Dev Build
112+ runs-on : ubuntu-latest
113+ steps :
114+ - uses : actions/checkout@v2
115+ - name : Set up JDK 1.8
116+ uses : actions/setup-java@v1
117+ with :
118+ java-version : 1.8
119+ - name : Cache Maven Packages
120+ uses : actions/cache@v1
121+ with :
122+ path : ~/.m2
123+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
124+ restore-keys : ${{ runner.os }}-m2
125+ - name : Build with Maven
126+ run : mvn clean install
127+ - name : Archive jar
128+ run : mkdir staging && cp target/*.jar staging
129+ - name : upload jar
130+ uses : actions/upload-artifact@v1
131+ with :
132+ name : ARTIFACT_NAME-DEVELOPMENT-BUILD
133+ path : staging
0 commit comments