-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3.24 KB
/
Modpack-Resourcepack.yml
File metadata and controls
98 lines (86 loc) · 3.24 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
name: 模組包 - 模組包資源包補丁
on:
workflow_call:
inputs:
force_include_files:
required: false
type: string
version_placeholder:
required: false
type: string
default: "$RELEASE_VERSION"
version:
required: false
type: string
outputs:
modpack_patch_resourcepack_maker:
description: "是否生成資源包"
value: ${{ jobs.Modpack-Resourcepack.outputs.patch_resourcepack_maker }}
jobs:
Modpack-Resourcepack:
name: 製作資源包補丁
runs-on: ubuntu-latest
outputs:
patch_resourcepack_maker: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker }}
steps:
- name: 查看專案
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 檢查資料夾存在
id: resourcepack-exist
run: |
if [ -f Patch-ResourcePack/pack.mcmeta ]; then
echo "patch_resourcepack_maker=True" >> "$GITHUB_OUTPUT"
echo "資源包補丁資料夾存在!"
cp LICENSE Patch-ResourcePack/
else
echo "patch_resourcepack_maker=False" >> "$GITHUB_OUTPUT"
echo "資源包補丁資料夾不存在!"
fi
- name: 自動替換版本變數到發布版本號
if: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker == 'True' }}
run: |
sed -i 's/${{ inputs.version_placeholder }}/'${{ inputs.version }}'/1' Patch-ResourcePack/pack.mcmeta
- name: 產生 Force Include 資料
id: force_include
run: |
{
echo 'data<<EOF'
python <(wget https://raw.githubusercontent.com/TeamKugimiya/reusable-workflows/main/scripts/force_include_generate.py -q -O-)
echo EOF
} >> "$GITHUB_OUTPUT"
env:
force_include_files: ${{ inputs.force_include_files }}
- name: 優化資源包
if: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker == 'True' }}
uses: ComunidadAylas/PackSquash-action@v4
with:
packsquash_version: latest-unstable
options: |
pack_directory = 'Patch-ResourcePack/'
never_store_squash_times = true
${{ steps.force_include.outputs.data }}
- name: 下載優化資源包成品
if: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker == 'True' }}
uses: actions/download-artifact@v4
with:
name: Optimized pack
path: ./
- name: 刪除優化資源包成品
if: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker == 'True' }}
uses: geekyeggo/delete-artifact@v5
with:
name: |
Optimized pack
- name: 重新命名資源包
if: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker == 'True' }}
run: |
modpack_name=$(yq e .modpack-name .github/configs/config.yml)
mv ./pack.zip ${modpack_name}-Patches.zip
- name: 上傳資源包
if: ${{ steps.resourcepack-exist.outputs.patch_resourcepack_maker == 'True' }}
uses: actions/upload-artifact@v4
with:
name: Patches-Resourcepack
path: "*.zip"