11# Creates releases on Curseforge and Github Releases based on v* tags
2- name : Latest Tag
2+ name : Tagged Commit Release
33
44on :
55 workflow_dispatch :
66
77jobs :
88 vars :
9- name : Get Variables
9+ name : Gather Variables
1010 runs-on : ubuntu-20.04
1111 outputs :
1212 release_type : ${{steps.cf_release_type.outputs.value }}
1313 cf_project : ${{steps.cf_project.outputs.value }}
14- mod_version : ${{steps.mod_version.outputs.value }}
1514 mod_id : ${{steps.mod_id.outputs.value }}
15+ version : ${{steps.version.outputs.version }}
16+
1617 steps :
1718 - name : Checkout
1819 uses : actions/checkout@v2
1920
21+ - name : Unshallow
22+ run : git fetch --prune --unshallow
23+
2024 - name : Release Type
2125 id : cf_release_type
2226 uses :
christian-draeger/[email protected] @@ -31,20 +35,28 @@ jobs:
3135 path : ' ./gradle.properties'
3236 property : ' cf_project'
3337
34- - name : Mod Version
35- id : mod_version
36- uses :
christian-draeger/[email protected] 37- with :
38- path : ' ./gradle.properties'
39- property : ' mod_version'
40-
4138 - name : Mod ID
4239 id : mod_id
4340 uses :
christian-draeger/[email protected] 4441 with :
4542 path : ' ./gradle.properties'
4643 property : ' mod_id'
4744
45+ - name : Find Current Tag
46+ id : current
47+ uses : jimschubert/query-tag-action@v1
48+ with :
49+ include : ' v*'
50+ exclude : ' *-rc*'
51+ commit-ish : ' @'
52+ skip-unshallow : ' true'
53+
54+ - name : Semver Version
55+ id : version
56+ run : |
57+ version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2)
58+ echo "::set-output name=version::$version"
59+
4860 changelog :
4961 name : Generate Changelog (tags)
5062 runs-on : ubuntu-20.04
@@ -114,22 +126,40 @@ jobs:
114126 distribution : ' temurin'
115127 java-version : " 17"
116128
117- - name : Cache Gradle packages
118- uses : actions/cache@v2
119- with :
120- path : |
121- ~/.gradle/caches
122- ~/.gradle/wrapper
123- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
124- restore-keys : ${{ runner.os }}-gradle-
125-
126129 - name : Grant execute permission for gradlew
127130 run : chmod +x gradlew
128131
129- - name : Build JAR with Gradle
130- run : ./gradlew build -x test
132+ - name : Create datagen assets
133+ run : ./gradlew runData
134+ timeout-minutes : 15
135+ env :
136+ CC_RELEASE : true
137+ CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
138+ CC_BUILD_NUM : " 0"
139+
140+ - name : Test JAR with GameTest Server
141+ run : ./gradlew runGameTestServer
142+ timeout-minutes : 20
143+ env :
144+ CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
145+ CC_BUILD_NUM : " 0"
146+ GITHUB_ACTOR : ${{ secrets.GITHUB_ACTOR }}
147+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
148+
149+ - name : Upload build failure
150+ if : failure()
151+ uses : actions/upload-artifact@v3
152+ with :
153+ name : test-data
154+ path : run/gametest
155+
156+ - name : Build JAR
157+ run : ./gradlew build
158+ timeout-minutes : 10
131159 env :
132- CM_RELEASE : true
160+ CC_RELEASE : true
161+ CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
162+ CC_BUILD_NUM : " 0"
133163 GITHUB_ACTOR : ${{ secrets.GITHUB_ACTOR }}
134164 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
135165
@@ -138,8 +168,8 @@ jobs:
138168 with :
139169 name : libs
140170 path : |
141- build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}.jar
142- build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}-api.jar
171+ build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar
172+ build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar
143173
144174 view :
145175 name : View Changelog Output
@@ -153,8 +183,8 @@ jobs:
153183 path : changelog
154184 - run : cat changelog/CHANGELOG.md
155185
156- release :
157- name : Make Releases
186+ release-gh :
187+ name : Make Github Release
158188 runs-on : ubuntu-20.04
159189 needs : [changelog, vars, jar]
160190 steps :
@@ -176,18 +206,38 @@ jobs:
176206 - name : Create GitHub Release
177207 uses : " marvinpinto/action-automatic-releases@latest"
178208 with :
179- title : " Release ${{ github.event.release.tag_name }}"
180- automatic_release_tag : " latest "
209+ title : " Release ${{ needs.vars.outputs.version }}"
210+ automatic_release_tag : " ${{ needs.vars.outputs.version }} "
181211 repo_token : " ${{ secrets.GITHUB_TOKEN }}"
182212 prerelease : false
183213 files : |
184214 changelog/CHANGELOG.md
185- build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}.jar
186- build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}-api.jar
215+ build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar
216+ build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar
217+
218+ release-cf :
219+ name : Make Curseforge Release
220+ runs-on : ubuntu-20.04
221+ needs : [changelog, vars, jar]
222+ steps :
223+ - name : Download Build Results
224+ uses : actions/download-artifact@v2
225+ with :
226+ name : libs
227+ path : build-out
228+ - name : Download Changelog Results
229+ uses : actions/download-artifact@v2
230+ with :
231+ name : out
232+ path : changelog
233+
234+ - name : Load Changelog File
235+ id : changelog
236+ run : echo ::set-output name=changelog::$(cat changelog/CHANGELOG.md)
187237
188238 - name : Full File
189239 id : filename
190- run : echo "::set-output name=fullpath::build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}.jar"
240+ run : echo "::set-output name=fullpath::build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar"
191241
192242 - name : Create CurseForge Release
193243 uses : itsmeow/curseforge-upload@master
@@ -198,20 +248,14 @@ jobs:
198248 file_path : ${{ steps.filename.outputs.fullpath }}
199249 changelog : ${{ steps.changelog.outputs.changelog }}
200250 changelog_type : markdown
201- game_versions : java:Java 8 ,Forge
251+ game_versions : java:Java 17 ,Forge
202252 release_type : ${{ needs.vars.outputs.release_type }}
203253
204254 publishMaven :
205255 name : Maven Release (GH Packages)
206256 runs-on : ubuntu-20.04
207257 needs : [changelog, vars, jar]
208258 steps :
209- - name : Download Changelog Results
210- uses : actions/download-artifact@v2
211- with :
212- name : out
213- path : changelog
214-
215259 - name : Checkout
216260 uses : actions/checkout@v2
217261
@@ -221,21 +265,17 @@ jobs:
221265 distribution : ' temurin'
222266 java-version : " 17"
223267
224- - name : Cache Gradle packages
225- uses : actions/cache@v2
226- with :
227- path : |
228- ~/.gradle/caches
229- ~/.gradle/wrapper
230- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
231- restore-keys : ${{ runner.os }}-gradle-
232-
233268 - name : Grant execute permission for gradlew
234269 run : chmod +x gradlew
235270
236- - name : Publish package
237- run : ./gradlew publishMavenPublicationToGitHubPackagesRepository -x test
271+ - name : Generate Resources
272+ run : ./gradlew runData
273+
274+ - name : Publish gradle nightly jar
275+ run : ./gradlew publishReleasePublicationToGitHubPackagesRepository
238276 env :
239- CM_RELEASE : " true"
277+ CC_RELEASE : true
278+ CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
279+ CC_BUILD_NUM : " 0"
240280 GITHUB_ACTOR : ${{ secrets.GITHUB_ACTOR }}
241281 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments