Merge branch 'Laskyyy:Astral-Experimental' into Astral-Experimental #1
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: Build with packwiz | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| artifacts: | |
| description: Upload artifacts | |
| required: true | |
| default: "true" | |
| serverpack: | |
| description: Create serverpack | |
| required: true | |
| default: "true" | |
| pull_request: | |
| branches: ["main", "Astral-Experimental"] | |
| push: | |
| branches: ["main", "Astral-Experimental"] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: "temurin" | |
| - name: Get latest packwiz binary | |
| id: download-packwiz | |
| uses: dawidd6/action-download-artifact@v6 | |
| with: | |
| workflow: go.yml | |
| branch: main | |
| name: Linux 64-bit x86 | |
| repo: packwiz/packwiz | |
| - name: Make packwiz binary executable | |
| shell: bash | |
| run: chmod +x ./packwiz | |
| - name: Restore cached mod downloads | |
| id: cache-mods-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: /home/runner/.cache/packwiz/cache | |
| key: cached-mods | |
| restore-keys: | | |
| cached-mods- | |
| - name: Construct version strings | |
| id: construct-base-name | |
| shell: bash | |
| run: | | |
| MODPACK_VERSION_NUMBER="$(echo "$(<pack.toml)" | grep "version =" | cut -d '"' -f 2)" | |
| echo "ASTRAL_CF_NAME=Create-Astral-CurseForge-$MODPACK_VERSION_NUMBER-${{github.run_number}}" >> "$GITHUB_OUTPUT" | |
| echo "ASTRAL_SERVER_NAME=Create-Astral-Server-$MODPACK_VERSION_NUMBER-${{github.run_number}}" >> "$GITHUB_OUTPUT" | |
| FABRIC_VERSION_NUMBER="$(echo "$(<pack.toml)" | grep "fabric =" | cut -d '"' -f 2)" | |
| echo "FABRIC_VERSION=$FABRIC_VERSION_NUMBER" >> "$GITHUB_OUTPUT" | |
| # servercore needs to be turned into a .toml for the curseforge export as CF won't accept it as an override jar | |
| - name: Prepare for CurseForge client zip creation | |
| shell: bash | |
| run: | | |
| mkdir temp-jar | |
| mv mods/servercore* ./temp-jar | |
| ./packwiz cf add https://www.curseforge.com/minecraft/mc-mods/servercore/files/4492100 | |
| - name: Create CurseForge client zip | |
| shell: bash | |
| run: | | |
| ./packwiz curseforge export -o "${{steps.construct-base-name.outputs.ASTRAL_CF_NAME}}.zip" | |
| ./packwiz refresh | |
| - name: Clean up after CurseForge client zip creation | |
| shell: bash | |
| run: | | |
| ./packwiz remove servercore | |
| mv temp-jar/servercore* ./mods | |
| rm -r ./temp-jar | |
| - name: Prepare for serverpack creation | |
| if: ${{ github.event.inputs.serverpack }} | |
| run: | | |
| cat server.packwizignore >> .packwizignore | |
| mv serverpack/* ./ | |
| ./packwiz refresh | |
| mkdir server | |
| - name: Download packwiz-installer-bootstrap | |
| if: ${{ github.event.inputs.serverpack }} | |
| uses: robinraju/release-downloader@v1.10 | |
| with: | |
| repository: packwiz/packwiz-installer-bootstrap | |
| latest: true | |
| fileName: packwiz-installer-bootstrap.jar | |
| - name: Create serverpack | |
| if: ${{ github.event.inputs.serverpack }} | |
| run: | | |
| cd server | |
| java -jar ../packwiz-installer-bootstrap.jar -g -s server ../pack.toml | |
| curl "https://meta.fabricmc.net/v2/versions/loader/1.18.2/${{steps.construct-base-name.outputs.FABRIC_VERSION}}/0.11.1/server/jar" --output server.jar | |
| rm -f packwiz-installer.jar | |
| rm -f packwiz.json | |
| ls -l | |
| cd ../ | |
| - name: Cache mod downloads | |
| id: cache-mods-save | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| /home/runner/.cache/packwiz/cache | |
| ./server/mods | |
| key: cached-mods-${{ hashFiles('/home/runner/.cache/packwiz/cache/**/*') }}-${{ hashFiles('./server/mods') }} | |
| # Otherwise the artifact would be a zip in a zip, which can't be automatically installed in launchers | |
| - name: Unpack client pack for nicer artifact | |
| if: ${{github.event.inputs.artifacts}} | |
| run: | | |
| unzip "${{steps.construct-base-name.outputs.ASTRAL_CF_NAME}}.zip" -d ./client | |
| - name: Upload client pack to GitHub | |
| if: ${{ github.event.inputs.artifacts }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{steps.construct-base-name.outputs.ASTRAL_CF_NAME}} | |
| path: ./client | |
| - name: Upload serverpack to GitHub | |
| if: ${{ github.event.inputs.serverpack && github.event.inputs.artifacts }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{steps.construct-base-name.outputs.ASTRAL_SERVER_NAME}} | |
| path: ./server |