Skip to content

Update hypixel config (#173) #40

Update hypixel config (#173)

Update hypixel config (#173) #40

Workflow file for this run

name: Sync settings
on:
push:
branches:
- 'master'
paths:
- LiquidBounce/settings/**
jobs:
upload_settings:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Upload Files
id: upload_files
env:
AUTHORIZATION: ${{ secrets.AUTHORIZATION }}
run: |
for branch_folder in LiquidBounce/settings/*; do
if [ -d "$branch_folder" ]; then
echo "Processing files in directory: $branch_folder"
for file in "$branch_folder"/*; do
if [ -f "$file" ]; then
setting_id=$(basename "$file" | cut -f 1 -d '.')
contributors=$(git log --follow --format="%aN" -- "$file" | sort | uniq | paste -sd "," -)
echo "Uploading file: $file"
echo "Contributors: $contributors"
curl -X POST -H "Authorization: $AUTHORIZATION" -F "settings_file=@$file" -F "name=$setting_id" -F "contributors=$contributors" "https://api.liquidbounce.net/api/v1/client/$(basename $branch_folder)/settings/upload/global"
fi
done
fi
done
- name: Delete Files
id: delete_files
env:
AUTHORIZATION: ${{ secrets.AUTHORIZATION }}
run: |
for branch_folder in LiquidBounce/settings/*; do
if [ -d "$branch_folder" ]; then
echo "Processing files in directory: $branch_folder"
deleted_files=$(git diff --diff-filter=D --name-only $last_commit HEAD -- "$branch_folder")
for deleted_file in $deleted_files; do
setting_id=$(basename "$deleted_file" | cut -f 1 -d '.')
echo "Deleting file: $setting_id"
curl -X DELETE -H "Authorization: $AUTHORIZATION" "https://api.liquidbounce.net/api/v1/client/settings/$setting_id"
done
fi
done