-
-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (101 loc) · 4.61 KB
/
build.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
name: Continuous Integration
# Controls when the action will run. Triggers the workflow on push or pull request.
on: [ push ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-24.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# java2bedrock REQUIRES jq 1.6, and fails if you have a newer jq version
- name: Install java2bedrock.sh dependencies
run: |
sudo apt-get install moreutils imagemagick unzip zip uuid-runtime
sudo wget -O /usr/bin/jq "https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64"
sudo npm install -g [email protected]
sudo npm i -g spritesheet-js
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%d%m%Y')"
- name: Compress Resource Pack
# This will also exclude the ".git" and ".github" folders from the Resource Pack
env:
DATE: ${{ steps.date.outputs.date }}
run: zip -9 -r SparklyPowerPlus_$DATE.zip . -x '*.git*' -x '*SparklyBedrockConverter*' -x 'pre_process_bedrock_resource_pack.sh'
- name: "Get SHA1 Hash of the Java Resource Pack and Send to GitHub Output"
env:
DATE: ${{ steps.date.outputs.date }}
run: echo "$(sha1sum SparklyPowerPlus_$DATE.zip)" >> $GITHUB_STEP_SUMMARY
- name: "Upload Java Resource Pack"
uses: actions/[email protected]
with:
name: SparklyPowerPlus Java
path: SparklyPowerPlus_${{ steps.date.outputs.date }}.zip
- name: Run Preprocess Bedrock Resource Pack Script
env:
DATE: ${{ steps.date.outputs.date }}
# Yes, the resource pack needs to be in the same folder as the script
run: |
chmod 777 pre_process_bedrock_resource_pack.sh
./pre_process_bedrock_resource_pack.sh
- name: Compress Resource Pack for Bedrock
# This will also exclude the ".git" and ".github" folders from the Resource Pack
env:
DATE: ${{ steps.date.outputs.date }}
run: zip -9 -r SparklyPowerPlus_Bedrock_$DATE.zip . -x '*.git*' -x '*SparklyBedrockConverter*'
# This is required because converter.sh seems to delete the "assets" folder
- name: Create new folder for the Bedrock Resource Pack and cd into it
run: |
mkdir bedrock_rp
cd bedrock_rp
- name: Download java2bedrock.sh
run: |
cd bedrock_rp
curl -o converter.sh https://raw.githubusercontent.com/Kas-tle/java2bedrock.sh/main/converter.sh
- name: Convert Java Resource Pack to Bedrock
env:
DATE: ${{ steps.date.outputs.date }}
# Yes, the resource pack needs to be in the same folder as the script
run: |
mv SparklyPowerPlus_Bedrock_$DATE.zip bedrock_rp
cd bedrock_rp
chmod 777 converter.sh
./converter.sh SparklyPowerPlus_Bedrock_$DATE.zip -w "false" -m "MyBedrock.mcpack" -a "entity_alphatest_one_sided" -b "alpha_test" -f "null" -v "1.19.2"
- name: Grant execute permission for gradlew
run: chmod +x SparklyBedrockConverter/gradlew
- name: Run SparklyBedrockConverter for the final touches for the Bedrock RP
# I tried using gradle-build-action, but the "--args" were always merged into a single argument
env:
DATE: ${{ steps.date.outputs.date }}
run: |
rootPwd=$(pwd)
cd bedrock_rp
bedrockPwd=$(pwd)
echo "Current path is $cwd"
cd ../SparklyBedrockConverter
./gradlew run --args="$rootPwd $bedrockPwd/target/unpackaged/rp $bedrockPwd/target/geyser_mappings.json"
- name: Compress Bedrock Resource Pack
# This will also exclude the ".git" and ".github" folders from the Resource Pack
env:
DATE: ${{ steps.date.outputs.date }}
run: |
cd bedrock_rp
(cd target/unpackaged/rp && zip -9 -r "$OLDPWD/SparklyPowerPlus_Bedrock_$DATE.mcpack" .)
- name: "Upload Bedrock Resource Pack"
uses: actions/[email protected]
with:
name: SparklyPowerPlus Bedrock
path: bedrock_rp/SparklyPowerPlus_Bedrock_${{ steps.date.outputs.date }}.mcpack
- name: "Upload Geyser Mappings"
uses: actions/[email protected]
with:
name: geyser_mappings.json
path: bedrock_rp/target/geyser_mappings.json