-
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (93 loc) · 4.22 KB
/
test_workflow.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
name: Continuous Deployment (Build)
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.14x-1.21x'
mc_version_range:
description: 'Minecraft version(s) the data pack runs in (encoded in version range spec)'
required: true
default: '>=1.14 <=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: Capture datapack build artifact
if: steps.check_datapack_folder.outputs.files_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: "More Mobs (Datapack)"
path: ./${{ github.event.repository.name }}-*.zip
- name: Capture mod build artifact
if: steps.check_mod_folder.outputs.files_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: "More Mobs (Mod)"
path: ./${{ github.event.repository.name }}-*-mod.jar