-
-
Notifications
You must be signed in to change notification settings - Fork 2
194 lines (175 loc) · 7.46 KB
/
cd.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
name: Continuous Deployment
on:
workflow_dispatch:
inputs:
tag:
description: 'Version of the data pack'
required: true
default: '1.0'
mc_version:
description: 'Minecraft version(s) the data pack runs in (human readable)'
required: true
default: '1.17x-1.21x'
mc_version_range:
description: 'Minecraft version(s) the data pack runs in (encoded in version range spec)'
required: true
default: '>=1.17 <=1.21'
jobs:
deploy:
runs-on: ubuntu-latest
name: Build and publish project
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
- name: Extract tag
id: tag_version
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Automatically set version numbers
- name: Find and replace uninstall file name
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${file_name}"
replace: ${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip
regex: false
include: "**uninstall.mcfunction"
- name: Find and replace data pack version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${version}"
replace: ${{ github.event.inputs.tag }}
regex: false
- name: Find and replace supported mc versions
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "${mc_version}"
replace: ${{ github.event.inputs.mc_version }}
regex: false
# Check for existence of datapack, mod and/or resourcepack folders.
- name: Check for data folder
id: check_datapack_folder
uses: andstor/file-existence-action@v3
with:
files: "data"
- name: Check for mod folders
id: check_mod_folder
uses: andstor/file-existence-action@v3
with:
files: "META-INF, net, fabric.mod.json, assets"
- name: Check for resource pack folder
id: check_assets_folder
uses: andstor/file-existence-action@v3
with:
files: "assets/minecraft"
# Package project
- name: Create data pack zip file
uses: montudor/action-zip@v1
if: steps.check_datapack_folder.outputs.files_exists == 'true'
with:
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip" -r . -x assets/* net/* META-INF/* fabric.mod.json unused/* src/* wiki/* CHANGES.md ".*"
- name: Create mod jar file
uses: montudor/action-zip@v1
if: steps.check_mod_folder.outputs.files_exists == 'true'
with:
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-mod.jar" -r . -x unused/* src/* wiki/* CHANGES.md ".*" "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip"
- name: Create asset pack zip file
uses: montudor/action-zip@v1
if: steps.check_assets_folder.outputs.files_exists == 'true'
with:
args: zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-resourcepack.zip" -r . -x data/* net/* META-INF/* fabric.mod.json unused/* src/* wiki/* CHANGES.md ".*" "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip" "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-mod.jar"
# Upload
- name: Upload data pack version to Modrinth
uses: Kir-Antipov/[email protected]
if: steps.check_datapack_folder.outputs.files_exists == 'true'
with:
modrinth-id: 7YjclEGc
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
game-versions: ${{ github.event.inputs.mc_version_range }}
game-version-filter: any
fail-mode: skip
name: "[DP] Release v${{ github.event.inputs.tag }}"
version: ${{ github.event.inputs.tag }}
changelog-file: CHANGES.md
loaders: |
datapack
files: |
./${{ github.event.repository.name }}-*.zip
- name: Upload mod version to Modrinth
uses: Kir-Antipov/[email protected]
if: steps.check_mod_folder.outputs.files_exists == 'true'
with:
modrinth-id: 7YjclEGc
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
game-versions: ${{ github.event.inputs.mc_version_range }}
game-version-filter: any
fail-mode: skip
name: "[Mod] Release v${{ github.event.inputs.tag }}"
version: ${{ github.event.inputs.tag }}+mod
changelog-file: CHANGES.md
dependencies: |
fabric-api(optional){modrinth:P7dR8mSH}
modmenu(optional){modrinth:mOgUt4GM}
modmenu-badges-lib(optional){modrinth:eUw8l2Vi}
midnightlib(optional){modrinth:codAaoxh}
loaders: |
fabric
forge
quilt
files: |
./${{ github.event.repository.name }}-*-mod.jar
- name: Upload data pack version to CurseForge
uses: Kir-Antipov/[email protected]
if: steps.check_datapack_folder.outputs.files_exists == 'true'
with:
curseforge-id: 831385
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
game-versions: ${{ github.event.inputs.mc_version_range }}
game-version-filter: any
fail-mode: skip
name: "Release v${{ github.event.inputs.tag }}"
version: ${{ github.event.inputs.tag }}
changelog-file: CHANGES.md
loaders: |
datapack
files: |
./${{ github.event.repository.name }}-*.zip
- name: Upload mod version to CurseForge
uses: Kir-Antipov/[email protected]
if: steps.check_mod_folder.outputs.files_exists == 'true'
with:
curseforge-id: 910095
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
game-versions: ${{ github.event.inputs.mc_version_range }}
game-version-filter: any
fail-mode: skip
name: "Release v${{ github.event.inputs.tag }}"
version: ${{ github.event.inputs.tag }}+mod
changelog-file: CHANGES.md
dependencies: |
catalogue(optional){curseforge:459701}
catalogue-fabric(optional){curseforge:667377}
midnightlib(optional){curseforge:488090}
java: |
Java 21
Java 17
Java 18
loaders: |
fabric
forge
quilt
files: |
./${{ github.event.repository.name }}-*-mod.jar
- name: Add changelog header for GitHub release
run: sed -i '1i_Changelog:_' CHANGES.md
- name: Upload outputs to GitHub releases
uses: Kir-Antipov/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-tag: v${{ github.event.inputs.tag }}
game-versions: ${{ github.event.inputs.mc_version_range }}
name: Release v${{ github.event.inputs.tag }}
version: v${{ github.event.inputs.tag }}
changelog-file: CHANGES.md
files: |
./${{ github.event.repository.name }}-*.@(zip|jar)