mirror of
https://github.com/darksaid98/optim.git
synced 2026-12-01 14:38:49 +00:00
refactor: add mc-modpack-kit template
This commit is contained in:
108 files changed
+773
No files matched your search
@@ -0,0 +1,53 @@
|
||||
name: 'Parse Modpack | Action'
|
||||
description: 'Parses a modpacks pack file'
|
||||
|
||||
inputs:
|
||||
modpack:
|
||||
description: 'Path to the modpack directory'
|
||||
required: false
|
||||
default: '.'
|
||||
pack-file:
|
||||
description: 'Path to the pack config file'
|
||||
required: false
|
||||
default: 'pack.toml'
|
||||
|
||||
outputs:
|
||||
loader:
|
||||
description: 'Detected mod loader'
|
||||
value: ${{ steps.parse.outputs.loader }}
|
||||
game-version:
|
||||
description: 'Detected game version'
|
||||
value: ${{ steps.parse.outputs.game-version }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
steps:
|
||||
|
||||
# --- Checkout repo
|
||||
- name: Check Out Git Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
||||
# --- Parse the pack.toml
|
||||
# I am bored so sorry that I don't explain this, you should probably read the code?
|
||||
- name: Parse the pack.toml
|
||||
id: parse
|
||||
run: |
|
||||
loaders=("fabric" "forge" "quilt" "neoforge")
|
||||
for loader in "${loaders[@]}"; do
|
||||
if [[ $(<"${{ inputs.pack-file }}") == *"$loader ="* ]]; then
|
||||
LOADER="$loader" && break
|
||||
fi
|
||||
done
|
||||
|
||||
[[ -z "$LOADER" ]] && { echo "::error file=${{ inputs.pack-file }}::No match found for loaders in ${{ inputs.pack-file }}" && exit 1; }
|
||||
|
||||
GAME_VERSION=$(grep -oP 'minecraft = "\K[^"]+' "${{ inputs.pack-file }}")
|
||||
echo "loader=$LOADER" >> $GITHUB_ENV
|
||||
echo "game-version=$GAME_VERSION" >> $GITHUB_ENV
|
||||
|
||||
echo "::notice ::⚙ The detected loader for ${{ inputs.modpack }} is $LOADER"
|
||||
echo "::notice ::⚙ The detected game version for ${{ inputs.modpack }} is $GAME_VERSION"
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.modpack }}
|
||||
Reference in new issue
Block a user