-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (53 loc) · 2.31 KB
/
extract-configs-proxy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: "Extract proxy configs"
on:
workflow_dispatch:
inputs:
proxy_type:
description: 'Proxy type'
required: true
jobs:
generate-minecraft-configs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Pull itzg/bungeecord image
run: docker pull itzg/bungeecord
- name: Start Minecraft Server
run: |
docker run -d \
-e EULA=TRUE \
-e TYPE=${{ github.event.inputs.proxy_type }} \
-p 25565:25577 \
--name minecraft-server \
itzg/bungeecord
- name: Wait for container to become healthy
run: |
while [[ "$(docker inspect -f '{{.State.Health.Status}}' minecraft-server)" != "healthy" ]]; do
if [[ "$(docker inspect -f '{{.State.Status}}' minecraft-server)" == "exited" ]]; then
echo "Container has stopped. Aborting workflow."
exit 1
fi
sleep 5
done
- name: Stop Minecraft Server
run: docker stop minecraft-server
- name: Copy configuration files
run: |
mkdir -p ${{ github.event.inputs.proxy_type }}
docker cp -q minecraft-server:/server/velocity.toml ./${{ github.event.inputs.proxy_type }}/velocity.toml || echo "not found, skipping"
docker cp -q minecraft-server:/server/config.yml ./${{ github.event.inputs.proxy_type }}/config.yml || echo "not found, skipping"
docker cp -q minecraft-server:/server/waterfall.yml ./${{ github.event.inputs.proxy_type }}/waterfall.yml || echo "not found, skipping"
- name: Commit configuration files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add ${{ github.event.inputs.proxy_type }}
git commit -m "Add configuration files for Proxy version ${{ github.event.inputs.proxy_type }}"
git push origin HEAD:${{ github.event.inputs.proxy_type }}
- name: Clear away Minecraft Server
run: docker rm minecraft-server