1
- name : Deploy preview modpack
1
+ name : Deploy Preview Modpack
2
2
3
3
permissions :
4
- contents : write
4
+ contents : read
5
5
deployments : write
6
6
7
7
on :
8
8
workflow_dispatch :
9
9
inputs :
10
+ target_branch :
11
+ description : ' Target branch for the preview'
12
+ type : string
13
+ required : true
10
14
version :
11
15
description : ' Modpack version'
12
16
required : true
15
19
required : true
16
20
17
21
env :
22
+ NAME : " GTExpert2"
18
23
VERSION_NORMAL : " v${{ github.event.inputs.version }}-pr-${{ github.event.inputs.preview_version }}"
19
24
VERSION_LWJGL3 : " v${{ github.event.inputs.version }}-lwjgl3-${{ github.event.inputs.preview_version }}"
20
- NAME : " GTExpert2"
21
25
22
26
jobs :
23
- deploy :
27
+ build :
24
28
runs-on : ubuntu-latest
25
29
strategy :
26
30
matrix :
27
- version : [ "NORMAL", "LWJGL3" ]
31
+ buildType : [standard, lwjgl3 ]
28
32
29
33
steps :
30
- - name : Checkout
34
+ - name : Checkout repository
31
35
uses : actions/checkout@v4
36
+ with :
37
+ ref : ${{ github.event.inputs.target_branch || github.ref }}
38
+ fetch-depth : 0
32
39
33
- - name : Setup Build
34
- uses : ./.github/actions/build_setup
40
+ - name : Cache dependencies
41
+ uses : actions/cache@v4
42
+ with :
43
+ path : |
44
+ ~/.m2/repository
45
+ ~/.cache/pip
46
+ key : ${{ runner.os }}-deps-${{ matrix.buildType }}-${{ hashFiles('**/pom.xml') }}
35
47
36
48
- name : Download Resource Packs zip
37
49
run : |
@@ -40,112 +52,154 @@ jobs:
40
52
ASSET_NAME=$(echo $ASSET_URL | awk -F'/' '{print $NF}')
41
53
wget -O ./overrides/resourcepacks/$ASSET_NAME $ASSET_URL
42
54
43
- - if : matrix.version == 'LWJGL3'
44
- name : Set the version (LWJGL3)
45
- run : |
46
- echo "[CleanroomMMC] GregTech Expert 2 ${{ env.VERSION_LWJGL3 }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
47
- sed -i -e "s/MODPACKVERSION/${{ env.VERSION_LWJGL3 }}/g" ./manifest.json
48
- sed -i -e "s/MODPACKVERSION/${{ env.VERSION_LWJGL3 }}/g" ./instance.cfg
49
- sed -i -e "s/MODPACKVERSION/${{ env.VERSION_LWJGL3 }}/g" ./overrides/config/craftpresence.json
55
+ - name : Setup Build Environment
56
+ uses : ./.github/actions/build_setup
50
57
51
- - if : matrix.version == 'NORMAL'
52
- name : Set the version (NORMAL)
53
- run : |
54
- echo "GregTech Expert 2 ${{ env.VERSION_NORMAL }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
55
- sed -i -e "s/MODPACKVERSION/${{ env.VERSION_NORMAL }}/g" ./manifest.json
56
- sed -i -e "s/MODPACKVERSION/${{ env.VERSION_NORMAL }}/g" ./instance.cfg
57
- sed -i -e "s/MODPACKVERSION/${{ env.VERSION_NORMAL }}/g" ./overrides/config/craftpresence.json
58
+ - name : Create artifacts directory
59
+ run : mkdir -p artifacts
58
60
59
- - if : matrix.version == 'LWJGL3'
60
- name : Remove lwjgl3 not supported mods
61
+ - name : Set Modpack Version
62
+ run : |
63
+ if [[ "${{ matrix.buildType }}" == "lwjgl3" ]]; then
64
+ VER="${{ env.VERSION_LWJGL3 }}"
65
+ echo "[CleanroomMMC] GregTech Expert 2 $VER" > overrides/config/txloader/load/custommainmenu/version.txt
66
+ else
67
+ VER="${{ env.VERSION_NORMAL }}"
68
+ echo "GregTech Expert 2 $VER" > ./overrides/config/txloader/load/custommainmenu/version.txt
69
+ fi
70
+ sed -i "s/MODPACKVERSION/$VER/g" manifest.json instance.cfg overrides/config/craftpresence.json
71
+
72
+ - name : Adjust for LWJGL3
73
+ if : matrix.buildType == 'lwjgl3'
61
74
run : |
62
75
python buildtools/gen-lwjgl3-manifest.py
63
- cp -vf ./ cmmc/manifest.json ./ manifest.json
76
+ cp -vf cmmc/manifest.json manifest.json
64
77
65
- - name : Run Python
78
+ - name : Install Mods
66
79
env :
67
80
CF_API_TOKEN : ${{ secrets.CF_API_TOKEN }}
68
81
run : python buildtools/mod-install.py
69
82
70
- - name : Remaove .gitkeep files
71
- run : find . -name ".gitkeep" -type f - delete
83
+ - name : Clean up placeholder files
84
+ run : find . -name ".gitkeep" -delete
72
85
73
- - if : matrix.version == 'NORMAL'
74
- name : Archive Release CF (NORMAL)
75
- run : zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip ./manifest.json ./modlist.html ./overrides/bansoukou/ ./overrides/config/ ./overrides/local/ ./overrides/resourcepacks/ ./overrides/scripts/
76
-
77
- - if : matrix.version == 'LWJGL3'
78
- name : Archive Release MMC (LWJGL3)
79
- run : |
80
- sed -i -e "s/B:EnableCustomGameTitle=false/B:EnableCustomGameTitle=true/g" ./overrides/config/stellar_core.cfg
81
- cp -rvf ./cmmc/bansoukou/ ./overrides/
82
- rm -Rf ./cmmc/bansoukou/
83
- mv -vf ./overrides/ .minecraft/
84
- cp -vf ./icon.png .minecraft/
85
- cp -rvf ./cmmc/* ./
86
- zip -r ./${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip ./libraries/ ./patches/ ./mmc-pack.json ./instance.cfg .minecraft/
87
-
88
- - if : matrix.version == 'NORMAL'
89
- name : Archive Release MMC (NORMAL)
86
+ - name : Package Artifacts
90
87
run : |
91
- mv -vf ./overrides/ .minecraft/
92
- cp -vf ./icon.png .minecraft/
93
- zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip ./mmc-pack.json ./instance.cfg .minecraft/
88
+ if [[ "${{ matrix.buildType }}" == "lwjgl3" ]]; then
89
+ sed -i "s/B:EnableCustomGameTitle=false/B:EnableCustomGameTitle=true/" overrides/config/stellar_core.cfg
90
+ cp -rvf cmmc/bansoukou/ overrides/
91
+ mv overrides .minecraft
92
+ cp icon.png .minecraft/
93
+ zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-mmc.zip libraries/ patches/ mmc-pack.json instance.cfg .minecraft/
94
+ mv serverfiles/* ./
95
+ rm -vf .minecraft/mods/!Red-Core-*
96
+ rm -vf .minecraft/mods/Alfheim-*
97
+ rm -vf .minecraft/mods/Valkyrie-*
98
+ rm -vf .minecraft/mods/CraftPresence-*
99
+ rm -vf .minecraft/mods/Controlling-*
100
+ rm -vf .minecraft/mods/UniLib-*
101
+ rm -vf .minecraft/mods/CustomMainMenu-*
102
+ rm -vf .minecraft/mods/Fixeroo-*
103
+ rm -vf .minecraft/mods/FpsReducer-*
104
+ rm -vf .minecraft/mods/modernsplash-*
105
+ rm -vf .minecraft/mods/RenderLib-*
106
+ rm -vf .minecraft/mods/particleculling-*
107
+ rm -vf .minecraft/mods/EntityCulling-*
108
+ rm -vf .minecraft/mods/SmoothFont-*
109
+ rm -vf .minecraft/mods/InGameInfoXML-*
110
+ rm -vf .minecraft/mods/oauth-*
111
+ rm -vf .minecraft/mods/UntranslatedItems-*
112
+ rm -vf .minecraft/mods/vintagefix-*
113
+ mv -vf .minecraft/* ./
114
+ zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-server.zip docker-compose.yml PleaseRead.txt log4j2_112-116.xml Install.* ServerStart.* settings.* TmuxServer.sh bansoukou/ config/ local/ mods/ resources/ scripts/
115
+ else
116
+ zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip ./manifest.json ./modlist.html ./overrides/bansoukou/ ./overrides/config/ ./overrides/local/ ./overrides/resourcepacks/ ./overrides/scripts/
117
+ mv overrides .minecraft
118
+ cp icon.png .minecraft/
119
+ zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip mmc-pack.json instance.cfg .minecraft/
120
+ mv serverfiles/* ./
121
+ rm -vf .minecraft/mods/!Red-Core-*
122
+ rm -vf .minecraft/mods/Alfheim-*
123
+ rm -vf .minecraft/mods/Valkyrie-*
124
+ rm -vf .minecraft/mods/CraftPresence-*
125
+ rm -vf .minecraft/mods/Controlling-*
126
+ rm -vf .minecraft/mods/UniLib-*
127
+ rm -vf .minecraft/mods/CustomMainMenu-*
128
+ rm -vf .minecraft/mods/Fixeroo-*
129
+ rm -vf .minecraft/mods/FpsReducer-*
130
+ rm -vf .minecraft/mods/modernsplash-*
131
+ rm -vf .minecraft/mods/RenderLib-*
132
+ rm -vf .minecraft/mods/particleculling-*
133
+ rm -vf .minecraft/mods/EntityCulling-*
134
+ rm -vf .minecraft/mods/SmoothFont-*
135
+ rm -vf .minecraft/mods/InGameInfoXML-*
136
+ rm -vf .minecraft/mods/oauth-*
137
+ rm -vf .minecraft/mods/UntranslatedItems-*
138
+ rm -vf .minecraft/mods/vintagefix-*
139
+ mv -vf .minecraft/* ./
140
+ zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip docker-compose.yml PleaseRead.txt log4j2_112-116.xml Install.* ServerStart.* settings.* TmuxServer.sh bansoukou/ config/ local/ mods/ resources/ scripts/
141
+ fi
142
+
143
+ - name : Upload Artifacts
144
+ uses : actions/upload-artifact@v4
145
+ with :
146
+ name : ${{ matrix.buildType }}-artifacts
147
+ path : artifacts/
148
+ retention-days : 1
94
149
95
- - if : matrix.version == 'NORMAL'
96
- name : Move Server Files (NORMAL)
97
- run : |
98
- mv -vf ./serverfiles/* ./
150
+ release :
151
+ needs : build
152
+ runs-on : ubuntu-latest
153
+ permissions :
154
+ contents : write
99
155
100
- - name : Remove Client Only Mods
156
+ steps :
157
+ - name : Checkout repository
158
+ uses : actions/checkout@v4
159
+ with :
160
+ ref : ${{ github.event.inputs.target_branch || github.ref }}
161
+ fetch-depth : 0
162
+
163
+ - name : Download All Artifacts
164
+ uses : actions/download-artifact@v4
165
+ with :
166
+ path : downloads
167
+
168
+ - name : Aggregate Artifacts
101
169
run : |
102
- rm -vf .minecraft/mods/!Red-Core-*
103
- rm -vf .minecraft/mods/Alfheim-*
104
- rm -vf .minecraft/mods/Valkyrie-*
105
- rm -vf .minecraft/mods/CraftPresence-*
106
- rm -vf .minecraft/mods/Controlling-*
107
- rm -vf .minecraft/mods/UniLib-*
108
- rm -vf .minecraft/mods/CustomMainMenu-*
109
- rm -vf .minecraft/mods/Fixeroo-*
110
- rm -vf .minecraft/mods/FpsReducer-*
111
- rm -vf .minecraft/mods/modernsplash-*
112
- rm -vf .minecraft/mods/RenderLib-*
113
- rm -vf .minecraft/mods/particleculling-*
114
- rm -vf .minecraft/mods/EntityCulling-*
115
- rm -vf .minecraft/mods/SmoothFont-*
116
- rm -vf .minecraft/mods/InGameInfoXML-*
117
- rm -vf .minecraft/mods/oauth-*
118
- rm -vf .minecraft/mods/UntranslatedItems-*
119
- rm -vf .minecraft/mods/vintagefix-*
120
-
121
- - if : matrix.version == 'NORMAL'
122
- name : Archive Release Server (NORMAL)
170
+ mkdir -p artifacts
171
+ for d in downloads/*; do
172
+ if [ -d "$d" ]; then
173
+ cp -r "$d"/* artifacts/ || true
174
+ fi
175
+ done
176
+
177
+ - name : Ensure Tag Exists
178
+ if : " !startsWith(github.ref, 'refs/tags/')"
123
179
run : |
124
- mv -vf .minecraft/* ./
125
- zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip ./docker-compose.yml ./PleaseRead.txt ./log4j2_112-116.xml ./Install.bat ./Install.sh ./ServerStart.bat ./ServerStart.sh ./settings.bat ./settings.sh ./TmuxServer.sh ./bansoukou/ ./config/ ./local/ ./mods/ ./resources/ ./scripts/
180
+ git config --global user.name "github-actions"
181
+ git config --global user.email "actions@github.com"
182
+ git tag ${{ env.VERSION_NORMAL }}
183
+ git push origin ${{ env.VERSION_NORMAL }}
126
184
127
- - if : matrix.version == 'NORMAL'
128
- name : Create GitHub Release (NORMAL)
185
+ - name : Create or Update GitHub Release
129
186
uses : softprops/action-gh-release@v2
130
187
with :
131
188
tag_name : ${{ env.VERSION_NORMAL }}
132
- prerelease : true
133
- generate_release_notes : true
134
- files : |
135
- ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip
136
- ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip
137
- ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip
189
+ name : " Preview ${{ env.VERSION_NORMAL }}"
190
+ body : |
191
+ ## GregTech Expert 2 - Preview Release
138
192
139
- - if : matrix.version == 'LWJGL3'
140
- name : Create GitHub Release (LWJGL3 )
141
- uses : softprops/action-gh-release@v2
142
- with :
143
- tag_name : ${{ env.VERSION_LWJGL3 }}
193
+ This preview includes:
194
+ - **Standard** (CurseForge / MultiMC / PrismLauncher / Server )
195
+ - **LWJGL3** (MultiMC / PrismLauncher only)
196
+
197
+ See installation guide for LWJGL3 [here](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/README.md).
144
198
prerelease : true
145
- body : |
146
- Note - This is LWJGL3 build and only available for MMC / PrismLauncher.
147
- FOLLOW THE INSTALLATION GUIDE [HERE](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/README.md).
148
- ---
149
- generate_release_notes : true
150
199
files : |
151
- ./${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip
200
+ artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip
201
+ artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip
202
+ artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip
203
+ artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-mmc.zip
204
+ env :
205
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments