mirror of
https://github.com/Kas-tle/java2bedrock.sh.git
synced 2025-12-27 10:39:07 +00:00
157 lines
7.0 KiB
YAML
157 lines
7.0 KiB
YAML
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 }}
|
|
steps:
|
|
- name: Issue Forms Body Parser
|
|
id: parse-issue
|
|
uses: zentered/issue-forms-body-parser@v1.5.1
|
|
- name: Organize Inputs
|
|
id: organize-inputs
|
|
run: |
|
|
echo ${{ toJSON(steps.parse-issue.outputs.data) }} | jq '
|
|
def test_input($input; $default):
|
|
if $input == "*No response*" then $default else ($input | 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.2"),
|
|
"block_material": test_input(.["block-material"].text; "alpha_test"),
|
|
"attachable_material": test_input(.["attachable-material"].text; "entity_alphatest_one_sided")
|
|
}' > 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
|
|
convert-pack:
|
|
runs-on: ubuntu-latest
|
|
needs: get-pack-info
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 30
|
|
outputs:
|
|
run_id: ${{ steps.get-pack-info.outputs.pack_url }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Enable default asset cache
|
|
id: cache-default-assets
|
|
uses: actions/cache@v3
|
|
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@v3
|
|
with:
|
|
node-version: 17
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get install -y moreutils zip
|
|
yarn global add spritesheet-js
|
|
- 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 }}
|
|
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}
|
|
- name: Upload converted pack
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Pack Files
|
|
path: |
|
|
staging/target/packaged/geyser_resources.mcpack
|
|
staging/target/packaged/geyser_addon.mcaddon
|
|
staging/target/geyser_mappings.json
|
|
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@v2
|
|
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/Kas-tle/java2bedrock.sh/actions/runs/${{ github.run_id}}
|
|
reactions: 'rocket'
|
|
- name: Close Issue
|
|
uses: peter-evans/close-issue@v2
|
|
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@v2
|
|
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/Kas-tle/java2bedrock.sh/actions/runs/${{ github.run_id}}
|
|
reactions: 'x'
|
|
- name: Close Issue
|
|
uses: peter-evans/close-issue@v2
|
|
with:
|
|
issue-number: ${{ github.event.issue.number }}
|