Files
Content-Monorepo/.forgejo/workflows/wf-resourcepack-build.yml

50 lines
1.6 KiB
YAML

name: Build Resource Pack
on:
push:
branches: [ "main" ]
paths:
- 'resourcepacks/**'
- '!resourcepacks/external/lce-resources/**'
workflow_dispatch:
jobs:
build:
runs-on: technocality
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Cache PackSquash
id: cache-packsquash
uses: https://github.com/actions/cache@v3
with:
path: ~/.cargo/bin/packsquash
key: packsquash-${{ runner.os }}
- name: Install PackSquash
if: steps.cache-packsquash.outputs.cache-hit != 'true'
run: |
apt-get update
apt-get install -y cmake
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo +nightly install --git https://github.com/ComunidadAylas/PackSquash --bin packsquash
- name: Build
id: build
run: |
source $HOME/.cargo/env
pack=$(git diff --name-only HEAD~1 HEAD | grep '^resourcepacks/' | sed 's|resourcepacks/[^/]*/\([^/]*\)/.*|\1|' | sort -u | head -1)
dir=$(find ./resourcepacks -type d -name "$pack" | head -1)
echo "pack=$pack" >> $GITHUB_OUTPUT
cat > /tmp/options.toml << EOF
pack_directory = '$dir'
output_file_path = '$pack.zip'
EOF
packsquash /tmp/options.toml
- name: Upload
uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.pack }}
path: ${{ steps.build.outputs.pack }}.zip