-
Notifications
You must be signed in to change notification settings - Fork 3
179 lines (157 loc) · 6.93 KB
/
preview.yml
File metadata and controls
179 lines (157 loc) · 6.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Deploy Preview Modpack
permissions:
contents: read
deployments: write
on:
workflow_dispatch:
inputs:
target_branch:
description: "Target branch for the preview"
type: string
required: true
version:
description: "Modpack version"
required: true
preview_version:
description: "Preview version"
required: true
env:
NAME: "GTExpert2"
JAVA8_CF: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-CF_Java_8"
JAVA8_MMC: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-MMC_Java_8"
JAVA8_SERVER: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-Server_Java_8"
JAVA_OPT: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-MMC_Java_25-26"
jobs:
build:
runs-on: ubuntu-slim
strategy:
matrix:
buildType: [standard, lwjgl3]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.target_branch || github.ref }}
fetch-depth: 0
- name: Download Resource Packs zip
run: |
GITHUB_RELEASE=$(curl -s https://api.github.com/repos/GTModpackTeam/GTE2-Translations/releases)
ASSET_URL=$(echo $GITHUB_RELEASE | jq -r '.[]."assets"[]."browser_download_url"' | grep "resourcepack" | head -1)
ASSET_NAME=$(echo $ASSET_URL | awk -F'/' '{print $NF}')
wget -O ./overrides/resourcepacks/$ASSET_NAME $ASSET_URL
- name: Setup Build Environment
uses: ./.github/actions/build_setup
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Set Modpack Version
run: |
if [[ "${{ matrix.buildType }}" == "lwjgl3" ]]; then
VER="${{ env.JAVA_OPT }}"
echo "[CleanroomMMC] GregTech Expert 2 $VER" > overrides/config/txloader/load/custommainmenu/version.txt
else
VER="${{ env.JAVA8_CF }}"
echo "GregTech Expert 2 $VER" > overrides/config/txloader/load/custommainmenu/version.txt
fi
sed -i "s/MODPACKVERSION/$VER/g" manifest.json instance.cfg overrides/config/craftpresence.json
BQVER=$(echo "${{ github.event.inputs.version }}" | tr -d '.')
sed -i "s/BQVERSION/$BQVER/g" overrides/config/betterquesting/DefaultQuests/QuestSettings.json
- name: Adjust for LWJGL3
if: matrix.buildType == 'lwjgl3'
run: |
uv run --directory ./buildtools python ./gen-lwjgl3-manifest.py
cp -vf cmmc/manifest.json manifest.json
- name: Install Mods
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: uv run --directory ./buildtools python ./mod-install.py
- name: Clean up placeholder files
run: find . -name ".gitkeep" -delete
- name: Package Artifacts
run: |
if [[ "${{ matrix.buildType }}" == "lwjgl3" ]]; then
sed -i "s/B:EnableCustomGameTitle=false/B:EnableCustomGameTitle=true/" overrides/config/stellar_core.cfg
mv -vf overrides/ .minecraft/
cp -vf icon.png .minecraft/
cp -rvf cmmc/* ./
zip -r artifacts/${{ env.NAME }}-${{ env.JAVA_OPT }}.zip patches/ mmc-pack.json instance.cfg .minecraft/
else
zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_CF }}.zip manifest.json modlist.html overrides/config/ overrides/local/ overrides/resourcepacks/icons/ overrides/resourcepacks/GTExpert2-* overrides/scripts/
mv overrides/ .minecraft/
cp icon.png .minecraft/
zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_MMC }}.zip mmc-pack.json instance.cfg .minecraft/
mv serverfiles/* ./
rm -vf .minecraft/mods/!Red-Core-*
rm -vf .minecraft/mods/Alfheim-*
rm -vf .minecraft/mods/CraftPresence-*
rm -vf .minecraft/mods/Controlling-*
rm -vf .minecraft/mods/UniLib-*
rm -vf .minecraft/mods/CustomMainMenu-*
rm -vf .minecraft/mods/Fixeroo-*
rm -vf .minecraft/mods/FpsReducer-*
rm -vf .minecraft/mods/modernsplash-*
rm -vf .minecraft/mods/RenderLib-*
rm -vf .minecraft/mods/particleculling-*
rm -vf .minecraft/mods/EntityCulling-*
rm -vf .minecraft/mods/SmoothFont-*
rm -vf .minecraft/mods/InGameInfoXML-*
rm -vf .minecraft/mods/oauth-*
rm -vf .minecraft/mods/UntranslatedItems-*
mv -vf .minecraft/* ./
zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_SERVER }}.zip docker-compose.yml PleaseRead.txt log4j2_112-116.xml Install.* ServerStart.* settings.* TmuxServer.sh config/ local/ mods/ resources/ scripts/
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.buildType }}-artifacts
path: artifacts/
retention-days: 1
release:
needs: build
runs-on: ubuntu-slim
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.target_branch || github.ref }}
fetch-depth: 0
- name: Download All Artifacts
uses: actions/download-artifact@v8
with:
path: downloads
- name: Aggregate Artifacts
run: |
mkdir -p artifacts
for d in downloads/*; do
if [ -d "$d" ]; then
cp -r "$d"/* artifacts/ || true
fi
done
- name: Ensure Tag Exists
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
git config --global user.name "github-actions"
git config --global user.email "actions@github.com"
git tag ${{ env.JAVA8_CF }}
git push origin ${{ env.JAVA8_CF }}
- name: Create or Update GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ github.event.inputs.version }}-pr-${{ github.event.inputs.preview_version }}"
name: "v${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}"
body: |
## GregTech Expert 2 Preview - ${{ github.event.inputs.version }}
This preview includes:
- **Java 8** (CurseForge / MultiMC / PrismLauncher / Server)
- **Java 25-26** (MultiMC / PrismLauncher only)
See installation guide for Java 25-26 [here](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/).
prerelease: true
generate_release_notes: true
files: |
artifacts/${{ env.NAME }}-${{ env.JAVA8_CF }}.zip
artifacts/${{ env.NAME }}-${{ env.JAVA8_MMC }}.zip
artifacts/${{ env.NAME }}-${{ env.JAVA8_SERVER }}.zip
artifacts/${{ env.NAME }}-${{ env.JAVA_OPT }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}