-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (122 loc) · 5.63 KB
/
release.yml
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
name: Deploy modpack
permissions:
contents: write
deployments: write
on:
workflow_dispatch:
inputs:
version:
description: 'Modpack version'
required: true
release_type:
description: 'Release type'
type: choice
default: 'release'
options:
- 'release'
- 'beta'
- 'alpha'
env:
VERSION_NORMAL: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}"
VERSION_LWJGL3: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}-lwjgl3"
NAME: "GTExpert2"
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ "NORMAL", "LWJGL3" ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if tag already exists
run: |
if git rev-parse --verify --quiet "v${{ github.event.inputs.version }}"; then
echo "Version ${{ github.event.inputs.version }} already exists, aborting workflow."
exit 1
fi
- name: Setup Build
uses: ./.github/actions/build_setup
- 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"' | head -1)
ASSET_NAME=$(echo $ASSET_URL | awk -F'/' '{print $NF}')
wget -O ./overrides/resourcepacks/$ASSET_NAME $ASSET_URL
- name: Set the version
run: |
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./manifest.json
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./instance.cfg
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./overrides/config/craftpresence.json
- if: matrix.version == 'LWJGL3'
name: Set the version (LWJGL3)
run: echo "[CleanroomMMC] GregTech Expert 2 ${{ env.VERSION_LWJGL3 }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
- if: matrix.version == 'NORMAL'
name: Set the version (NORMAL)
run: echo "GregTech Expert 2 ${{ env.VERSION_NORMAL }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
- if: matrix.version == 'LWJGL3'
name: Remove lwjgl3 not supported mods
run: |
python buildtools/gen-lwjgl3-manifest.py
cp -vf ./cmmc/manifest.json ./manifest.json
- name: Run Python
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: python buildtools/mod-install.py
- if: matrix.version == 'NORMAL'
name: Archive Release CF (NORMAL)
run: |
rm -rf ./overrides/resourcepacks/.gitkeep
zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip ./manifest.json ./modlist.html ./manifest.json ./modlist.html ./overrides/bansoukou/ ./overrides/config/ ./overrides/local/ ./overrides/resourcepacks/ ./overrides/scripts/
- if: matrix.version == 'LWJGL3'
name: Archive Release MMC (LWJGL3)
run: |
cp -rvf ./cmmc/bansoukou/ ./overrides/
rm -Rf ./cmmc/bansoukou/
mv -vf ./overrides/ .minecraft/
cp -vf ./icon.png .minecraft/
cp -rvf ./cmmc/* ./
rm -rf .minecraft/mods/.gitkeep
rm -rf .minecraft/resourcepacks/.gitkeep
zip -r ./${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip ./libraries/ ./patches/ ./mmc-pack.json ./instance.cfg .minecraft/
- if: matrix.version == 'NORMAL'
name: Archive Release MMC (NORMAL)
run: |
mv -vf ./overrides/ .minecraft/
cp -vf ./icon.png .minecraft/
rm -rf .minecraft/mods/.gitkeep
zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip ./mmc-pack.json ./instance.cfg .minecraft/
- if: matrix.version == 'NORMAL'
name: Move Server Files
run: |
mv -vf ./serverfiles/* ./
- if: matrix.version == 'NORMAL'
name: Archive Release Server
run: |
mv -vf .minecraft/* ./
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/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: "${{ env.VERSION_NORMAL }}"
draft: false
prerelease: false
generate_release_notes: true
files: |
./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip
./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip
./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip
./${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip
# - name: Upload Curseforge
# uses: Xikaro/[email protected]
# with:
# api-token: ${{ secrets.CF_API_TOKEN }}
# project-id: '565238'
# modpack-path: ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip
# modpack-server-path: ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip
# changelog: 'Check the changes here. [Github - CHANGELOG.md](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/CHANGELOG_v2.md "")'
# changelog-format: markdown
# game-version: '1.12.2'
# display-name: ${{ env.NAME }}-${{ env.VERSION_NORMAL }}
# server-display-name: ${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server
# release-type: ${{ github.event.inputs.release_type }}