Build #2
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "Build what" | |
| required: true | |
| default: "build-all" | |
| type: choice | |
| options: | |
| - build-client | |
| - build-server | |
| - build-all | |
| version: | |
| description: "Version" | |
| required: true | |
| default: "DevBuild" | |
| type: string | |
| workflow_call: | |
| inputs: | |
| target: | |
| required: true | |
| default: "build-all" | |
| type: string | |
| version: | |
| required: true | |
| type: string | |
| jobs: | |
| pack_pr: | |
| if: ( !contains(github.event.head_commit.message, '[ci skip]') ) | |
| name: Pack PR | |
| runs-on: ubuntu-22.04 | |
| concurrency: | |
| group: pack_pr-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup node and npm | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 23 | |
| cache: 'npm' | |
| cache-dependency-path: build/package-lock.json | |
| - name: Restore mods cache | |
| uses: actions/cache@v4 | |
| with: | |
| # observe if this makes broken builds due to outdated mods (server onl) | |
| path: | | |
| dist/mod_cache | |
| key: ${{ runner.os }}-mods-${{ hashFiles('manifest.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-mods- | |
| - name: Restore modlist cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: dist/modlist.html | |
| key: ${{ runner.os }}-modlist-${{ hashFiles('manifest.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-modlist- | |
| - name: Replace manifest version | |
| run: | |
| sed -i s/\"version\":\ \"development\"/\"version\":\ \"${{ inputs.version }}\"/ manifest.json | |
| shell: bash | |
| # Core mod pack mode switcher requires java | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Pack Modpack | |
| run: | | |
| cd build | |
| npm install | |
| node index.ts ${{ inputs.target }} | |
| shell: bash | |
| - name: Upload client build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: client-build | |
| path: dist/client.zip | |
| if-no-files-found: ignore | |
| overwrite: true | |
| compression-level: 9 | |
| - name: Upload server build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: server-build | |
| path: dist/server.zip | |
| if-no-files-found: ignore | |
| overwrite: true | |
| compression-level: 9 |