-
Notifications
You must be signed in to change notification settings - Fork 3
157 lines (135 loc) · 5.31 KB
/
preview.yml
File metadata and controls
157 lines (135 loc) · 5.31 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
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"
VERSION_NORMAL: "v${{ github.event.inputs.version }}-pr-${{ github.event.inputs.preview_version }}"
VERSION_LWJGL3: "v${{ github.event.inputs.version }}-lwjgl3-${{ github.event.inputs.preview_version }}"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
buildType: [standard, lwjgl3]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch || github.ref }}
fetch-depth: 0
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.cache/pip
key: ${{ runner.os }}-deps-${{ matrix.buildType }}-${{ hashFiles('**/pom.xml') }}
- name: Download Resource Pack
uses: actions/download-release@v2
with:
repository: GTModpackTeam/GTE2-Translations
tag: latest
asset: 'resourcepack*.zip'
token: ${{ github.token }}
path: overrides/resourcepacks
- 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.VERSION_LWJGL3 }}"
else
VER="${{ env.VERSION_NORMAL }}"
fi
echo "[CleanroomMMC] GregTech Expert 2 $VER" > overrides/config/txloader/load/custommainmenu/version.txt
sed -i "s/MODPACKVERSION/$VER/g" manifest.json instance.cfg overrides/config/craftpresence.json
- name: Adjust for LWJGL3
if: matrix.buildType == 'lwjgl3'
run: |
python buildtools/gen-lwjgl3-manifest.py
cp -vf cmmc/manifest.json manifest.json
- name: Install Mods
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: python buildtools/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
cp -rvf cmmc/bansoukou/ overrides/
mv overrides .minecraft
cp icon.png .minecraft/
cp -rvf cmmc/* ./
zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip libraries/ patches/ mmc-pack.json instance.cfg .minecraft/
else
zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip manifest.json modlist.html overrides/
mv overrides .minecraft
cp icon.png .minecraft/
zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip mmc-pack.json instance.cfg .minecraft/
mv serverfiles/* ./
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/
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.buildType }}-artifacts
path: artifacts/
retention-days: 1
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: downloads
- name: Aggregate Artifacts
run: |
mkdir -p artifacts
cp -r downloads/*/artifacts/* artifacts/
- 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.VERSION_NORMAL }}
git push origin ${{ env.VERSION_NORMAL }}
- name: Create or Update GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION_NORMAL }}
name: "Preview ${{ env.VERSION_NORMAL }}"
body: |
## GregTech Expert 2 - Preview Release
This preview includes:
- **Standard** (CurseForge / MultiMC / PrismLauncher / Server)
- **LWJGL3** (MultiMC / PrismLauncher only)
See installation guide for LWJGL3 [here](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/README.md).
prerelease: true
files: |
artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip
artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip
artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip
artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}