Skip to content

✨ Improve the bs.hitbox module (#252) #39

✨ Improve the bs.hitbox module (#252)

✨ Improve the bs.hitbox module (#252) #39

Workflow file for this run

name: πŸš€ Deploy on server
on:
push:
branches: [master]
workflow_dispatch:
inputs:
sync:
description: "File synchronization"
required: true
default: "delta"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Deploy files
uses: milanmk/actions-file-deployer@master
with:
remote-protocol: "sftp"
remote-host: ${{ secrets.SFTP_IP }}
remote-port: ${{ secrets.SFTP_PORT }}
remote-user: ${{ secrets.SFTP_SANDBOX_USER }}
remote-password: ${{ secrets.SFTP_PASSWORD }}
remote-path: /bookshelf-world/
ftp-mirror-options: "--include-glob=**/*.mca --include-glob=datapacks/** --include-glob=level.dat --include-glob=icon.png"
- name: Restart server
env:
SERVER_RESTART_ENDPOINT: ${{ secrets.SERVER_RESTART_ENDPOINT }}
SERVER_RESTART_BEARER: ${{ secrets.SERVER_RESTART_BEARER }}
run: |
server_full_status=$(curl "$SERVER_RESTART_ENDPOINT/resources" -H 'Accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer $SERVER_RESTART_BEARER" -X GET)
server_power_status=$(jq -r '.attributes.current_state' <<<"$server_full_status")
if [ $server_power_status = 'running' ]; then
echo "Bookshelf's test server is online, restarting it to apply updates"
curl "$SERVER_RESTART_ENDPOINT/power" -H 'Accept: application/json' -H 'Content-Type: application/json' -H "Authorization: Bearer $SERVER_RESTART_BEARER" -X POST -d '{"signal": "restart"}'
else
echo "Bookshelf's test server is offline, it will not be started"
fi