Server Run #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Server Run | |
| on: | |
| workflow_run: | |
| workflows: ["Setup Server"] | |
| inputs: | |
| should_add_op: | |
| type: boolean | |
| default: false | |
| description: Whether to apply the value of op_name input. | |
| required: true | |
| op_name: | |
| type: string | |
| required: false | |
| description: The Minecraft username of a player to make an operator. | |
| default: "devnull03" | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| inputs: | |
| should_add_op: | |
| type: boolean | |
| default: false | |
| description: Whether to apply the value of op_name input. | |
| required: true | |
| op_name: | |
| type: string | |
| required: false | |
| description: The Minecraft username of a player to make an operator. | |
| default: "devnull03" | |
| concurrency: | |
| group: server-run | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| name: clone repo locally | |
| - name: setup jdk 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 21 | |
| distribution: "microsoft" | |
| - name: Run Playit.gg Tunnel (Docker) | |
| run: | | |
| echo "==========================================" | |
| echo "Starting Playit.gg tunnel for Minecraft" | |
| echo "==========================================" | |
| docker run -d --network host -e SECRET_KEY=${{ secrets.PLAYIT_SECRET }} ghcr.io/playit-cloud/playit-agent:0.16 | |
| sleep 10 | |
| echo "\n===========================================" | |
| - name: Run Server (Long) | |
| id: run_server | |
| run: ${{inputs.should_add_op && 'printf "op ' || ''}}${{inputs.should_add_op && inputs.op_name || ''}}${{inputs.should_add_op && '" | ' || ''}}java -Xmx6G -jar fabric-server-mc.1.21.10-loader.0.18.1-launcher.1.1.0.jar nogui | |
| # Maximum workflow duration is 360 minutes. | |
| # Setting this prevents progress from being lost by forgetting to stop the server. | |
| timeout-minutes: 320 | |
| continue-on-error: true | |
| - name: Save World and Server Data to GitHub | |
| run: | | |
| git pull | |
| git config user.name github-actions | |
| git config user.email actions@github.com | |
| git add world/ | |
| git add logs/ | |
| git add *.json | |
| git add *.properties | |
| git add *.txt | |
| git add banned-*.json | |
| git add ops.json | |
| git add whitelist.json | |
| git add usercache.json | |
| git commit -m "$(cat commit-message.txt)" || echo "No changes to commit" | |
| git push |