name: pull on: push: branches: - main env: CONTAINER_NAME: mc-neoforge # название контейнера jobs: saving: name: Save and backup minecraft world runs-on: ubuntu-latest container: image: alpine/git volumes: - /imp-data/minecraft-backups:/workspace/backups # путь до бэкапов - /opt/minecraft/TeStVISt-mods-server:/workspace/project # путь до модов - /opt/minecraft/data:/workspace/data # путь до данных майнкрафт-сервера defaults: run: working-directory: /workspace/backups steps: - name: main run: | LAST_BACKUP_TIME=$(date +%F-%T) mkdir $LAST_BACKUP_TIME cp -R -t $LAST_BACKUP_TIME ../data/world cp -t $LAST_BACKUP_TIME ../project/README.md pulling: name: Pull repo to the mods directory runs-on: ubuntu-latest needs: saving container: image: alpine/git volumes: - /opt/minecraft/TeStVISt-mods-server:/workspace/project # путь до модов defaults: run: working-directory: /workspace/project steps: - name: main run: | git fetch origin main git reset --hard origin/main restarting: name: Restart minecraft server runs-on: ubuntu-latest needs: pulling container: image: docker steps: - name: main run: | docker exec ${{ env.CONTAINER_NAME }} rcon-cli 'tellraw @a {"text":"Подъехала ", "extra":[{"text":"обнова", "underlined":true, "bold":true, "color":"green", "clickEvent":{"action":"open_url", "value":"https://gitea.aklivtsov.tech/LeterZP/TeStVISt-mods-server"}}, {"text":" модов. "}, {"text":"Рестарт", "bold":true, "color":"red"}, {"text":" сервера через "}, {"text":"30 секунд!", "bold":true, "color":"red"}]}' docker exec ${{ env.CONTAINER_NAME }} rcon-cli 'title @a times 10 100 10' && docker exec mc-neoforge rcon-cli 'title @a title {"text":"Подъехала ", "extra":[{"text":"обнова", "bold":true, "color":"green"}, {"text":" модов."}]}' && docker exec mc-neoforge rcon-cli 'title @a subtitle {"text":"", "extra":[{"text":"Рестарт", "bold":true, "color":"red"}, {"text":" сервера через "}, {"text":"30 секунд!", "bold":true, "color":"red"}]}' sleep 30 docker exec ${{ env.CONTAINER_NAME }} rcon-cli stop