Setup Server #3
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: Setup Server | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| eula_agree: | |
| type: boolean | |
| required: true | |
| description: Do you agree to the Minecraft EULA? https://www.minecraft.net/en-us/eula | |
| default: true | |
| motd: | |
| type: string | |
| description: The MOTD to set in server.properties. | |
| default: A Minecraft server running in \u00a79\u00a7lGitHub Actions\u00a7r\nSee \u00a76devnull03\/actions-minecraft-server | |
| permissions: | |
| contents: write | |
| jobs: | |
| setup_server: | |
| 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: Generate Server Files | |
| run: java -Xmx7G -jar forge-1.20.1-47.4.13-installer.jar --installServer | |
| - name: Edit eula.txt | |
| if: inputs.eula_agree | |
| run: bash ./scripts/modify-eula.sh | |
| - name: Change MOTD | |
| run: bash ./scripts/modify-motd.sh "${{ inputs.motd }}" | |
| - name: Save to GitHub | |
| run: | | |
| git pull | |
| git config user.name github-actions | |
| git config user.email actions@github.com | |
| git add . | |
| git commit -m "Generate server files" | |
| git push |