CD #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: CD | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: "Publish artifacts from electron-builder" | |
| required: true | |
| default: "never" | |
| type: choice | |
| options: | |
| - never | |
| - always | |
| linux_setup_id: | |
| description: "Config setup ID used to source Linux engine resource" | |
| required: true | |
| default: "latest-linux" | |
| type: string | |
| windows_setup_id: | |
| description: "Config setup ID used to source Windows engine resource" | |
| required: true | |
| default: "latest-win" | |
| type: string | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| build_cmd: "build-linux" | |
| arch: "--x64" | |
| platform: "linux" | |
| - os: windows-latest | |
| build_cmd: "build-win" | |
| arch: "--x64" | |
| platform: "win32" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # This should fix git rev-list --count HEAD | |
| # https://stackoverflow.com/a/65056108 | |
| fetch-depth: 0 | |
| submodules: recursive | |
| path: repo-folder | |
| - uses: actions/checkout@v6 | |
| with: | |
| repository: gajop/spring-launcher | |
| submodules: recursive | |
| path: spring-launcher | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: "3.13" | |
| - name: Prepare folder structure | |
| run: | | |
| mkdir build | |
| cp spring-launcher/* -r build/ | |
| cp repo-folder/dist_cfg/* -r build/src/ | |
| mkdir -p build/{bin,files,build} | |
| [ -d build/src/bin/ ] && mv build/src/bin/* build/bin/ | |
| [ -d build/src/files/ ] && mv build/src/files/* build/files/ | |
| [ -d build/src/build/ ] && mv build/src/build/* build/build/ | |
| rm -rf build/src/{bin,files,build} | |
| tree -a -L 3 build | |
| - name: Prepare packaged assets | |
| run: | | |
| GIT_HASH=$(git -C repo-folder rev-parse --short=12 HEAD) | |
| PACKAGE_VERSION=1.$(git -C repo-folder rev-list --count HEAD).0 | |
| uv run --project ./repo-folder/build --locked sbc-packager-package \ | |
| --repo-root ./repo-folder \ | |
| --config-in ./repo-folder/dist_cfg/config.json \ | |
| --config-out ./build/src/config.json \ | |
| --files-dir ./build/files \ | |
| --meta-out ./build/build/package-assets.json \ | |
| --package-json ./build/package.json \ | |
| --repo-full-name Spring-SpringBoard/SpringBoard-Core \ | |
| --platform "${{ matrix.platform }}" \ | |
| --git-hash "$GIT_HASH" \ | |
| --package-version "$PACKAGE_VERSION" \ | |
| --linux-setup-id "${{ github.event.inputs.linux_setup_id }}" \ | |
| --windows-setup-id "${{ github.event.inputs.windows_setup_id }}" | |
| cat build/package.json | |
| - name: Build | |
| run: | | |
| cd build | |
| npm install | |
| npm run ${{ matrix.build_cmd }} -- ${{ matrix.arch }} --publish "${{ github.event.inputs.publish }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: springboard-${{ matrix.platform }}-bundle | |
| path: build/dist/** | |
| if-no-files-found: error |