[Pack]: For Xmas #6814
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Conversion Request | |
on: | |
issues: | |
types: | |
- labeled | |
jobs: | |
get-pack-info: | |
runs-on: ubuntu-latest | |
if: github.event.label.name == 'conversion' | |
permissions: | |
issues: read | |
timeout-minutes: 2 | |
outputs: | |
pack_url: ${{ steps.organize-inputs.outputs.PACK_URL }} | |
default_pack_url: ${{ steps.organize-inputs.outputs.DEFAULT_PACK_URL }} | |
merge_pack_url: ${{ steps.organize-inputs.outputs.MERGE_PACK_URL }} | |
default_assets_version: ${{ steps.organize-inputs.outputs.DEFAULT_ASSETS_VERSION }} | |
block_material: ${{ steps.organize-inputs.outputs.BLOCK_MATERIAL }} | |
attachable_material: ${{ steps.organize-inputs.outputs.ATTACHABLE_MATERIAL }} | |
archive_scratch: ${{ steps.organize-inputs.outputs.ARCHIVE_SCRATCH }} | |
rename_model_files: ${{ steps.organize-inputs.outputs.RENAME_MODEL_FILES }} | |
font_conversion: ${{ steps.organize-inputs.outputs.FONT_CONVERSION}} | |
armor_conversion: ${{ steps.organize-inputs.outputs.ARMOR_CONVERSION}} | |
meg3_fix: ${{ steps.organize-inputs.outputs.MEG3_FIX}} | |
sounds_conversion: ${{ steps.organize-inputs.outputs.SOUNDS_CONVERSION }} | |
bow_conversion: ${{ steps.organize-inputs.outputs.BOW_CONVERSION }} | |
shield_conversion: ${{ steps.organize-inputs.outputs.SHIELD_CONVERSION }} | |
block_conversion: ${{ steps.organize-inputs.outputs.BLOCK_CONVERSION }} | |
steps: | |
- name: Issue Forms Body Parser | |
id: parse-issue | |
uses: zentered/[email protected] | |
- name: Organize Inputs | |
id: organize-inputs | |
run: | | |
echo ${{ toJSON(steps.parse-issue.outputs.data) }} | jq ' | |
def test_input($input; $default): | |
if ($input == "*No response*" or $input == "None") then $default else ($input | tostring | gsub("\\\\";"")) end; | |
{ | |
"pack_url": .["java-pack-direct-download-url"].text[1:-1], | |
"default_pack_url": test_input(.["default-pack-direct-download-url"].text; " null ")[1:-1], | |
"merge_pack_url": test_input(.["bedrock-merge-pack-direct-download-url"].text; " null ")[1:-1], | |
"default_assets_version": test_input(.["default-assets-version"].text; "1.19.3"), | |
"block_material": test_input(.["block-material"].text; "alpha_test"), | |
"attachable_material": test_input(.["attachable-material"].text; "entity_alphatest_one_sided"), | |
"archive_scratch": test_input(.["archive-scratch-files"].text; "false"), | |
"rename_model_files": test_input(.["rename-model-files"].text; "false"), | |
"font_conversion": test_input(.["font-conversion"].text; "false"), | |
"armor_conversion": test_input(.["armor-conversion"].text; "false"), | |
"meg3_fix": test_input(.["meg3-fix"].text; "false"), | |
"sounds_conversion": test_input(.["sounds-conversion"].text; "false"), | |
"bow_conversion": test_input(.["bow-conversion"].text; "false"), | |
"shield_conversion": test_input(.["shield-conversion"].text; "false"), | |
"block_conversion": test_input(.["block-conversion"].text; "false") | |
}' > inputs.json | |
echo "PACK_URL=$(jq -r '.pack_url' inputs.json)" >> $GITHUB_OUTPUT | |
echo "DEFAULT_PACK_URL=$(jq -r '.default_pack_url' inputs.json)" >> $GITHUB_OUTPUT | |
echo "MERGE_PACK_URL=$(jq -r '.merge_pack_url' inputs.json)" >> $GITHUB_OUTPUT | |
echo "DEFAULT_ASSETS_VERSION=$(jq -r '.default_assets_version' inputs.json)" >> $GITHUB_OUTPUT | |
echo "BLOCK_MATERIAL=$(jq -r '.block_material' inputs.json)" >> $GITHUB_OUTPUT | |
echo "ATTACHABLE_MATERIAL=$(jq -r '.attachable_material' inputs.json)" >> $GITHUB_OUTPUT | |
echo "ARCHIVE_SCRATCH=$(jq -r '.archive_scratch' inputs.json)" >> $GITHUB_OUTPUT | |
echo "RENAME_MODEL_FILES=$(jq -r '.rename_model_files' inputs.json)" >> $GITHUB_OUTPUT | |
echo "FONT_CONVERSION=$(jq -r '.font_conversion' inputs.json)" >> $GITHUB_OUTPUT | |
echo "ARMOR_CONVERSION=$(jq -r '.armor_conversion' inputs.json)" >> $GITHUB_OUTPUT | |
echo "MEG3_FIX=$(jq -r '.meg3_fix' inputs.json)" >> $GITHUB_OUTPUT | |
echo "SOUNDS_CONVERSION=$(jq -r '.sounds_conversion' inputs.json)" >> $GITHUB_OUTPUT | |
echo "BOW_CONVERSION=$(jq -r '.bow_conversion' inputs.json)" >> $GITHUB_OUTPUT | |
echo "SHIELD_CONVERSION=$(jq -r '.bow_conversion' inputs.json)" >> $GITHUB_OUTPUT | |
echo "BLOCK_CONVERSION=$(jq -r '.block_conversion' inputs.json)" >> $GITHUB_OUTPUT | |
convert-pack: | |
runs-on: ubuntu-latest | |
needs: get-pack-info | |
permissions: | |
contents: read | |
timeout-minutes: 90 | |
outputs: | |
run_id: ${{ steps.get-pack-info.outputs.pack_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Enable default asset cache | |
id: cache-default-assets | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/work/java2bedrock.sh/java2bedrock.sh/staging/default_assets.zip | |
key: ${{ runner.os }}-${{ needs.get-pack-info.outputs.default_assets_version }} | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y moreutils zip | |
yarn global add spritesheet-js | |
sudo apt-get install -y imagemagick | |
pip install Pillow | |
pip install requests | |
pip install jproperties | |
- name: Convert Pack | |
id: convert-pack | |
continue-on-error: false | |
env: | |
PACK_URL: ${{ needs.get-pack-info.outputs.pack_url }} | |
DEFAULT_PACK_URL: ${{ needs.get-pack-info.outputs.default_pack_url }} | |
MERGE_PACK_URL: ${{ needs.get-pack-info.outputs.merge_pack_url }} | |
DEFAULT_ASSETS_VERSION: ${{ needs.get-pack-info.outputs.default_assets_version }} | |
BLOCK_MATERIAL: ${{ needs.get-pack-info.outputs.block_material }} | |
ATTACHABLE_MATERIAL: ${{ needs.get-pack-info.outputs.attachable_material }} | |
ARCHIVE_SCRATCH: ${{ needs.get-pack-info.outputs.archive_scratch }} | |
RENAME_MODEL_FILES: ${{ needs.get-pack-info.outputs.rename_model_files }} | |
FONT_CONVERSION: ${{ needs.get-pack-info.outputs.font_conversion }} | |
ARMOR_CONVERSION: ${{ needs.get-pack-info.outputs.armor_conversion }} | |
MEG3_FIX: ${{ needs.get-pack-info.outputs.meg3_fix }} | |
SOUNDS_CONVERSION: ${{ needs.get-pack-info.outputs.sounds_conversion }} | |
BOW_CONVERSION: ${{ needs.get-pack-info.outputs.bow_conversion }} | |
SHIELD_CONVERSION: ${{ needs.get-pack-info.outputs.shield_conversion }} | |
BLOCK_CONVERSION: ${{ needs.get-pack-info.outputs.block_conversion }} | |
run: | | |
mkdir -p staging | |
cp converter.sh staging/ | |
cd staging | |
chmod +x converter.sh | |
COLUMNS=$COLUMNS-1 curl --no-styled-output -#L -o input_pack.zip "${PACK_URL}" | |
MERGE_PACK_FILE="${MERGE_PACK_URL}" | |
if [ "${MERGE_PACK_URL}" != "null" ]; then | |
COLUMNS=$COLUMNS-1 curl --no-styled-output -#L -o merge_pack.zip "${MERGE_PACK_URL}" | |
MERGE_PACK_FILE="merge_pack.zip" | |
fi | |
./converter.sh input_pack.zip -w "false" -m ${MERGE_PACK_FILE} -a ${ATTACHABLE_MATERIAL} -b ${BLOCK_MATERIAL} -f ${DEFAULT_PACK_URL} -v ${DEFAULT_ASSETS_VERSION} -r ${RENAME_MODEL_FILES} -s ${ARCHIVE_SCRATCH} -u "true" | |
- name: Upload converted pack | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PackFiles | |
path: | | |
staging/target/packaged/geyser_resources.mcpack | |
staging/target/packaged/geyser_addon.mcaddon | |
staging/target/*.json | |
staging/target/scratch_files.zip | |
staging/config.json | |
post-result: | |
runs-on: ubuntu-latest | |
needs: convert-pack | |
timeout-minutes: 2 | |
permissions: | |
issues: write | |
steps: | |
- name: Post Result | |
id: post-result | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
## :sparkles: The run has finished! :sparkles: | |
- Download the pack files from the [action run][1] page. :arrow_double_down: | |
- Upload the resource pack `geyser_resources.mcpack` to the `packs` folder of your Geyser folder. :file_folder: | |
- Upload the mappings file `geyser_mappings.json` to the `custom_mappings` folder of your Geyser folder. :page_with_curl: | |
If you notice issues with the converted files, please refer to the action log for errors and open a bug report if you believe there is an issue with the converter. This issue will be closed automatically. | |
[1]: https://github.com/azpixel-team/java2bedrock/actions/runs/${{ github.run_id}} | |
reactions: 'rocket' | |
- name: Close Issue | |
uses: peter-evans/close-issue@v3 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
conversion-failed: | |
runs-on: ubuntu-latest | |
needs: [get-pack-info, convert-pack, post-result] | |
if: always() && (needs.get-pack-info.result == 'failure' || needs.convert-pack.result == 'failure' || needs.convert-pack.result == 'post-result') | |
timeout-minutes: 2 | |
permissions: | |
issues: write | |
steps: | |
- name: Post Result | |
id: post-result | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
## :stop_sign: The run has failed :stop_sign: | |
- Check the [action run][1] page for errors. :clipboard: | |
- Status by job: | |
- Get Pack Info: *${{ needs.get-pack-info.result }}* | |
- Convert Pack: *${{ needs.convert-pack.result }}* | |
- Post Result: *${{ needs.post-result.result }}* | |
If you believe this is an issue with the converter. please open a bug report. This issue will be closed automatically. | |
[1]: https://github.com/azpixel-team/java2bedrock/actions/runs/${{ github.run_id}} | |
reactions: 'x' | |
- name: Close issue | |
uses: peter-evans/close-issue@v3 | |
with: | |
issue-number: ${{ github.event.issue.number }} |