@@ -2,6 +2,7 @@ name: Gradle Tests and Nightly (CI)
22
33env :
44 GH_PKG_URL : " https://maven.pkg.github.com/${{ github.repository }}"
5+ CC_RELEASE : false
56
67on :
78 workflow_dispatch :
@@ -27,26 +28,31 @@ jobs:
2728 name : Get Variables
2829 runs-on : ubuntu-22.04
2930 outputs :
30- version : ${{steps.version.outputs.version }}
31- build : ${{steps.build.outputs.buildver}}
31+ version : ${{steps.version.outputs.version_format}}
32+ build : ${{steps.version.outputs.increment}}
33+ mcVersion : ${{steps.gradle_props.outputs.minecraft_version}}
34+ forgeVersion : ${{steps.gradle_props.outputs.forge_version}}
3235
3336 steps :
3437 - name : Checkout
3538 uses : actions/checkout@v3
39+ with :
40+ fetch-depth : 0
3641
37- - name : Unshallow
38- run : git fetch --prune --unshallow
39-
40- - name : Find Current Tag
42+ - name : Version
4143 id : version
42- run : echo "version=$(git describe --tags --abbrev=0 --match 'v*' --exclude '*-rc*' '@')" >> $GITHUB_OUTPUT
44+ 45+ with :
46+ change_path : " forge-api/ forge-main/"
47+ version_format : " ${major}.${minor}.${patch}"
48+ search_commit_body : true
4349
44- - name : Build Version
45- id : build
46- run : |
47- buildver=$(git describe --tags --match v* | cut -d- -f2)
48- echo "build = $buildver "
49- echo "buildver=$buildver" >> $GITHUB_OUTPUT
50+ - name : Read MC and Forge versions
51+ id : gradle_props
52+ uses : christian-draeger/[email protected] 53+ with :
54+ path : " gradle.properties "
55+ properties : " minecraft_version forge_version "
5056
5157 build-info :
5258 name : Build Info
6773 - name : Checkout
6874 uses : actions/checkout@v3
6975
70- - name : Unshallow and Get Tags
71- run : git fetch --prune --unshallow --tags
72-
7376 - name : Set up JDK
7477 uses : actions/setup-java@v3
7578 with :
9295 mkdir run/test
9396
9497 - name : Generate Datagen Assets
95- run : ./gradlew runData --stacktrace --info
98+ uses : gradle/gradle-build-action@v2
99+
100+ - name : Generate Datagen Assets
101+ run : ./gradlew runData
96102 env :
97- CC_RELEASE : false
98103 CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
99104 CC_BUILD_NUM : ${{ needs.vars.outputs.build }}
100105
@@ -103,7 +108,7 @@ jobs:
103108 uses : actions/upload-artifact@v3
104109 with :
105110 name : generated-data
106- path : src/generated/resources
111+ path : forge-main/ src/generated/resources
107112
108113 - name : Upload Failure
109114 if : failure()
@@ -115,7 +120,6 @@ jobs:
115120 - name : Test JAR with GameTest Server
116121 run : ./gradlew runGameTestServer
117122 env :
118- CC_RELEASE : false
119123 CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
120124 CC_BUILD_NUM : ${{ needs.vars.outputs.build }}
121125
@@ -126,8 +130,8 @@ jobs:
126130 name : test-data
127131 path : run/gametest
128132
129- nightly :
130- name : Publish Nightly
133+ publish-gh-package :
134+ name : Publish Github Package
131135 runs-on : ubuntu-22.04
132136 needs : [ vars, tests ]
133137 steps :
@@ -147,16 +151,82 @@ jobs:
147151 uses : gradle/gradle-build-action@v2
148152
149153 - name : Pull Built Data
150- uses : actions/download-artifact@v2
154+ uses : actions/download-artifact@v3
151155 with :
152156 name : generated-data
153- path : src/generated/resources
157+ path : forge-main/ src/generated/resources
154158
155159 - name : Publish gradle nightly jar
156- run : ./gradlew publishMainPublicationToGitHubPackagesRepository
160+ run : ./gradlew publishAllLibsPublicationToGitHubPackagesRepository
157161 env :
158- CC_RELEASE : false
159162 CC_SEMVER_VERSION : ${{ needs.vars.outputs.version }}
160163 CC_BUILD_NUM : ${{ needs.vars.outputs.build }}
161164 GITHUB_ACTOR : ${{ secrets.GITHUB_ACTOR }}
162165 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
166+ get-package-info :
167+ name : Get Latest Package Info
168+ runs-on : ubuntu-22.04
169+ needs : [ publish-gh-package ]
170+ outputs :
171+ version : ${{ steps.download-info.outputs.version }}
172+ steps :
173+ - name : Download Package Info
174+ id : download-info
175+ uses :
compactmods/[email protected] 176+ env :
177+ GQL_TOKEN : ${{ secrets.GITHUB_TOKEN }}
178+ with :
179+ owner : compactmods
180+ repo : compactcrafting
181+ group : dev.compactmods.compactcrafting
182+ filter : " ^compactcrafting-(?:[\\ d\\ .]+)-nightly.jar$"
183+ outputFile : compactcrafting-nightly.json
184+
185+ - name : Debug output
186+ run : |
187+ echo "Version: ${{ steps.download-info.outputs.version }}"
188+ cat compactcrafting-nightly.json
189+ - name : Read info into variable [latest]
190+ id : info
191+ run : echo "latestJson=$(cat compactcrafting-nightly.json)" >> $GITHUB_OUTPUT
192+
193+ - name : Download JAR and prepare artifacts
194+ run : |
195+ mkdir release
196+ curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}"
197+ mv compactcrafting-nightly.json release/compactcrafting-nightly.json
198+
199+ - name : Add Artifact
200+ uses : actions/upload-artifact@v3
201+ with :
202+ name : release
203+ path : release
204+
205+ announce :
206+ name : Discord Announcement
207+ needs : [ vars, get-package-info ]
208+ runs-on : ubuntu-22.04
209+ steps :
210+ - name : Grab JAR and Info
211+ uses : actions/download-artifact@v3
212+ with :
213+ name : release
214+ path : .
215+
216+ - name : Read info into variable [latest]
217+ id : info
218+ run : echo "latestJson=$(cat compactcrafting-nightly.json)" >> $GITHUB_OUTPUT
219+
220+ - name : Announce Release
221+ uses :
compactmods/[email protected] 222+ env :
223+ DISCORD_BOT_TOKEN : ${{ secrets.DISCORD_BOT_TOKEN }}
224+ with :
225+ filename : ${{ fromJson(steps.info.outputs.latestJson)[0].name}}
226+ channel : ${{ secrets.NIGHTLY_CHANNEL_ID }}
227+ modName : Compact Crafting
228+ modVersion : ${{ needs.get-package-info.outputs.version }}
229+ thumbnail : https://media.forgecdn.net/avatars/thumbnails/324/502/64/64/637440523810696496.png
230+
231+ forgeVersion : ${{ needs.vars.outputs.forgeVersion }}
232+ mcVersion : ${{ needs.vars.outputs.mcVersion }}
0 commit comments