-
Notifications
You must be signed in to change notification settings - Fork 16
308 lines (268 loc) · 11.9 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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: Build
run-name: "Build #${{ github.run_number }}"
on:
push:
tags:
- "*.*.*"
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
RELEASE_TYPE: "RELEASE"
jobs:
info:
name: Project Info
runs-on: ubuntu-latest
outputs:
project_version: ${{ steps.project_version.outputs.tag }}
project_name: ${{ steps.project_name.outputs.value }}
mc_version: ${{ steps.mc_version.outputs.value }}
changelog: ${{ steps.changelog.outputs.description }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Get tag
id: project_version
uses: "WyriHaximus/github-action-get-previous-tag@v1.4.0"
with:
fallback: tag_not_found
- name: Get project name
id: project_name
uses: ActionsTools/read-json-action@main
with:
file_path: ".github/buildtools/modpack/manifest.json"
prop_path: "name"
- name: Get project name
id: mc_version
uses: ActionsTools/read-json-action@main
with:
file_path: ".github/buildtools/modpack/manifest.json"
prop_path: "minecraft.version"
- name: Changelog Parser
id: changelog
uses: coditory/changelog-parser@v1.0.2
with:
path: CHANGELOG.md
build-cf-modpack:
name: Build CF Modpack
runs-on: ubuntu-latest
needs: [info]
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Replace strings
shell: bash
run: |
VERSION=${{ needs.info.outputs.project_version }}
sed -i -e "s/DEV/${VERSION}/g" .github/buildtools/modpack/manifest.json
sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/gui_main_menu.txt
- name: Export CF
run: |
mkdir -p overrides
mv -vf {config,defaultconfigs,kubejs} overrides/
mv -vf .github/buildtools/modpack/manifest.json ./
mv -vf .github/buildtools/modpack/modlist.html ./
zip -r ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-cf.zip manifest.json modlist.html overrides
- name: Upload zip cf
uses: actions/upload-artifact@v4.0.0
with:
name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-cf
path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-cf.zip
retention-days: 5
build-mmc-modpack:
name: Build MMC Modpack
runs-on: ubuntu-latest
needs: [info]
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Replace strings
shell: bash
run: |
VERSION=${{ needs.info.outputs.project_version }}
sed -i -e "s/DEV/${VERSION}/g" .github/buildtools/modpack/instance.cfg
sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/gui_main_menu.txt
- name: Download Mods
run: |
git submodule init
cd mods
git config --global credential.helper '!f() {
echo "username=Xikaro";
echo "password=${{ secrets.USER_TOKEN_XIKARO }}"; }; f'
git submodule update --recursive
- name: Export MMC
run: |
mkdir -p .minecraft
mkdir -p flame
mv -vf {config,defaultconfigs,kubejs,mods} .minecraft/
mv -vf .github/buildtools/modpack/mmc-pack.json ./
mv -vf .github/buildtools/modpack/instance.cfg ./
mv -vf .github/buildtools/modpack/modlist.html ./
mv -vf .github/buildtools/modpack/manifest.json flame/
find .minecraft/mods -name "probejs-*" -delete;
find .minecraft/mods -name ".git" -delete;
zip -r ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-mmc.zip icon.png mmc-pack.json instance.cfg .minecraft/ flame/
- name: Upload zip mmc
uses: actions/upload-artifact@v4.0.0
with:
name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-mmc
path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-mmc.zip
retention-days: 5
build-serverpack:
name: Build Serverpack
runs-on: ubuntu-latest
needs: [info]
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Download Mods
run: |
git submodule init
cd mods
git config --global credential.helper '!f() {
echo "username=Xikaro";
echo "password=${{ secrets.USER_TOKEN_XIKARO }}"; }; f'
git submodule update --recursive
- name: Replace strings
shell: bash
run: |
VERSION=${{ needs.info.outputs.project_version }}
sed -i -e "s/DEV/${VERSION}/g" .github/buildtools/modpack/manifest.json
sed -i -e "s/DEV/${VERSION}/g" config/fancymenu/customization/gui_main_menu.txt
- name: Export serverpack
run: |
mkdir -p .minecraft
mv -vf {config,defaultconfigs,kubejs,mods,.github/buildtools/serverpack/*} .minecraft
cat .github/buildtools/client_mod.txt | while read -r line; do find .minecraft/mods -name "$line" -delete; done
zip -r ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server.zip .minecraft/*
- name: Upload zip
uses: actions/upload-artifact@v4.0.0
with:
name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server
path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server.zip
retention-days: 5
release-curseforge:
name: Deploy to CurseForge
needs: [info, build-cf-modpack, build-serverpack]
runs-on: ubuntu-latest
outputs:
cf_release_id: ${{ steps.cf_release.outputs.id }}
steps:
- name: Check if CF_API_TOKEN exist
shell: bash
run: |
if [ "${{ secrets.CF_API_TOKEN }}" == '' ]; then
echo '::error::No value found for secret key `CF_API_TOKEN`. See https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository' && exit 1
fi
- name: Download cf modpack
uses: actions/download-artifact@v4.1.0
with:
name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-cf
- name: Download serverpack
uses: actions/download-artifact@v4.1.0
with:
name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server
- name: Upload Curseforge
id: cf_release
uses: Xikaro/upload-curseforge-modpack-action@1.1.1
with:
api-token: ${{ secrets.CF_API_TOKEN }}
project-id: ${{ vars.CF_MODPACK_ID }}
modpack-path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-cf.zip
modpack-server-path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server.zip
changelog: ${{ needs.info.outputs.changelog }}
changelog-format: markdown
game-version: ${{ needs.info.outputs.mc_version }}
display-name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}
server-display-name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server
release-type: ${{ env.RELEASE_TYPE }}
# release-modrinth:
# name: Deploy to Modrinth
# runs-on: ubuntu-latest
# steps:
# - name: Check if MODRINTH_API_TOKEN exist
# shell: bash
# run: |
# if [ "${{ secrets.MODRINTH_API_TOKEN }}" == '' ]; then
# echo '::error::No value found for secret key `MODRINTH_API_TOKEN`. See https://docs.github.com/en/ actionssecurity-guides/ encrypted-secrets#creating-encrypted-secrets-for-a-repository' && exit 1
# fi
# - name: Download modpack
# uses: actions/download-artifact@v4.1.0
# with:
# name: modpack_mrd
# - name: Download serverpack
# uses: actions/download-artifact@v4.1.0
# with:
# name: server_pack
# - name: Upload Modrinth
# id: cf_release
# uses: SwitchAlpha/upload-curseforge-modpack-action@master
# with:
# api-token: ${{ secrets.MODRINTH_API_TOKEN }}
# project-id: ${{ vars.MODRINTH_MODPACK_ID }}
# modpack-path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-mrd.zip
# modpack-server-path: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server.zip
# changelog: ${{ needs.info.outputs.changelog }}
# changelog-format: markdown
# game-version: ${{ needs.info.outputs.mc_version }}
# display-name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}
# server-display-name: ${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server
# release-type: ${{ env.RELEASE_TYPE }}
release-github:
name: Deploy to GitHub
needs: [info, build-cf-modpack, build-mmc-modpack, build-serverpack]
runs-on: ubuntu-latest
steps:
- name: Download modpack
uses: actions/download-artifact@v4.1.0
with:
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v1
with:
prerelease: false
generate_release_notes: true
name: ${{ needs.info.outputs.project_version }}
body: ${{ needs.info.outputs.changelog }}
files: |
${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-cf.zip
${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-mmc.zip
${{ needs.info.outputs.project_name }}-${{ needs.info.outputs.project_version }}-server.zip
tag_name: ${{ needs.info.outputs.project_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
discord-message:
name: Discord Message
needs: [info, release-github, release-curseforge]
runs-on: ubuntu-latest
steps:
- name: Send Discord message
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{secrets.RELEASES_1_20}}
username: "TerraFirmaGreg"
avatar-url: "https://raw.githubusercontent.com/TerraFirmaGreg-Team/.github/main/branding/curseforge.png"
embed-title: Release ${{ needs.info.outputs.project_version }}
embed-url: https://github.com/${{ github.repository }}/releases/tag/${{ needs.info.outputs.project_version }}
embed-thumbnail-url: https://raw.githubusercontent.com/TerraFirmaGreg-Team/.github/main/branding/logo.png
embed-description: |
**Release Type**: `${{ env.RELEASE_TYPE }}`
**GameVersion**: `${{ needs.info.outputs.mc_version }}`
**Website Link**: [CurseForge](https://www.curseforge.com/minecraft/modpacks/terrafirmagreg/files/${{ needs.release-curseforge.outputs.cf_release_id }})
** Сhangelog **
```${{ needs.info.outputs.changelog }}```
** [More details...](https://github.com/TerraFirmaGreg-Team/Modpack-1.20.x/blob/main/CHANGELOG.md) **
embed-color: 5814783
# close-fixed-issues:
# name: Close Fixed Issues
# needs: [info, release-github, release-curseforge]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4.1.1
# - name: Сlose fixed in dev
# uses: juraj-hrivnak/close-issues-based-on-label@master
# env:
# LABEL: "2. Status: Fixed in Dev"
# VERSION: ${{ needs.info.outputs.project_version }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}