mirror of
https://github.com/Nostalgica-Reverie/Content-Monorepo.git
synced 2026-05-09 00:24:15 +00:00
111 lines
2.9 KiB
YAML
111 lines
2.9 KiB
YAML
name: Auto Update
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
auto-update:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GH_PAT }}
|
|
fetch-depth: 1
|
|
|
|
# Cache Packwiz binary to avoid Go setup and compilation
|
|
- name: Cache Packwiz Binary
|
|
uses: actions/cache@v4
|
|
id: cache-packwiz
|
|
with:
|
|
path: ~/go/bin/packwiz
|
|
key: packwiz-binary-${{ runner.os }}-v1
|
|
restore-keys: |
|
|
packwiz-binary-${{ runner.os }}-
|
|
|
|
# Only set up Go and install Packwiz if not cached
|
|
- name: Set up Go
|
|
if: steps.cache-packwiz.outputs.cache-hit != 'true'
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 'stable'
|
|
cache: false
|
|
|
|
- name: Install Packwiz
|
|
if: steps.cache-packwiz.outputs.cache-hit != 'true'
|
|
run: go install github.com/packwiz/packwiz@latest
|
|
|
|
# Add Packwiz to PATH (whether cached or freshly installed)
|
|
- name: Add Packwiz to PATH
|
|
run: echo "$HOME/go/bin" >> $GITHUB_PATH
|
|
|
|
- name: Update All Modpacks
|
|
run: |
|
|
BATCH_SIZE=2
|
|
WAIT_TIME=18
|
|
|
|
vpacks=(re-console re-console-lite)
|
|
pfvs=(curseforge modrinth)
|
|
mlvs=(fabric)
|
|
mcvs=(1.20.1 1.20.4 1.21.1 1.21.3 1.21.4 1.21.5 1.21.8)
|
|
|
|
batch=()
|
|
run_batch() {
|
|
echo "Running batch of ${#batch[@]} updates"
|
|
pids=()
|
|
logs=()
|
|
|
|
for idx in "${!batch[@]}"; do
|
|
log_file="update_log_$idx.txt"
|
|
logs+=("$log_file")
|
|
|
|
bash -c "${batch[$idx]}" > "$log_file" 2>&1 &
|
|
pids+=($!)
|
|
done
|
|
|
|
# Wait for all background tasks to finish
|
|
for pid in "${pids[@]}"; do
|
|
wait $pid
|
|
done
|
|
|
|
# Show logs
|
|
for idx in "${!logs[@]}"; do
|
|
echo
|
|
echo "==== Output for Task $((idx + 1)) ===="
|
|
cat "${logs[$idx]}"
|
|
echo "==== End Output for Task $((idx + 1)) ===="
|
|
echo
|
|
done
|
|
|
|
echo "Batch complete, waiting ${WAIT_TIME} seconds..."
|
|
echo
|
|
sleep ${WAIT_TIME}
|
|
batch=()
|
|
}
|
|
|
|
for i in "${vpacks[@]}"; do
|
|
for q in "${pfvs[@]}"; do
|
|
for w in "${mlvs[@]}"; do
|
|
for e in "${mcvs[@]}"; do
|
|
DIR="./versions/vanilla/src/$i/$q/$w/$e"
|
|
if [ -d "$DIR" ]; then
|
|
echo "Queued: $i $q $w $e"
|
|
batch+=("cd \"$DIR\" && packwiz refresh -y && packwiz update -a -y")
|
|
if [ "${#batch[@]}" -eq "$BATCH_SIZE" ]; then
|
|
run_batch
|
|
fi
|
|
fi
|
|
done
|
|
done
|
|
done
|
|
done
|
|
|
|
# Final batch if anything remains
|
|
if [ "${#batch[@]}" -gt 0 ]; then
|
|
run_batch
|
|
fi
|
|
|
|
- name: Commit Updates
|
|
uses: EndBug/add-and-commit@v9.1.4
|
|
with:
|
|
default_author: github_actions |