|
| 1 | +name: CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + pull_request: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + name: ${{ matrix.platform.name }} ${{ matrix.backend.name }} ${{ matrix.config.name }} |
| 17 | + runs-on: ${{ matrix.platform.os }} |
| 18 | + |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + platform: |
| 23 | + - { name: Windows, os: windows-latest } |
| 24 | + - { name: Linux, os: ubuntu-latest } |
| 25 | + - { name: macOS AMD64, os: macos-13 } |
| 26 | + - { name: macOS AArch64, os: macos-latest } |
| 27 | + backend: |
| 28 | + - { name: GNS, flags: -DUSE_STEAMWORKS=FALSE } |
| 29 | + - { name: Steamworks, flags: -DUSE_STEAMWORKS=TRUE } |
| 30 | + config: |
| 31 | + - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } |
| 32 | + - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + submodules: ${{matrix.backend.name == 'GNS'}} |
| 39 | + |
| 40 | + - name: Cache Steamworks SDK |
| 41 | + if: matrix.backend.name == 'Steamworks' |
| 42 | + id: cache-steamworks-sdk |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: sdk.zip |
| 46 | + key: steamworks-sdk-162 |
| 47 | + |
| 48 | + - name: Download Steamworks SDK |
| 49 | + if: matrix.backend.name == 'Steamworks' && steps.cache-steamworks-sdk.outputs.cache-hit != 'true' |
| 50 | + uses: suisei-cn/actions-download-file@v1.6.0 |
| 51 | + with: |
| 52 | + filename: sdk.zip |
| 53 | + target: . |
| 54 | + url: https://partner.steamgames.com/downloads/steamworks_sdk_162.zip |
| 55 | + |
| 56 | + - name: Unzip Steamworks SDK |
| 57 | + if: matrix.backend.name == 'Steamworks' |
| 58 | + shell: bash |
| 59 | + run: unzip sdk.zip |
| 60 | + |
| 61 | + - name: Install CMake |
| 62 | + uses: lukka/get-cmake@latest |
| 63 | + |
| 64 | + - name: Install Windows GNS Dependencies |
| 65 | + if: matrix.backend.name == 'GNS' && runner.os == 'Windows' |
| 66 | + uses: lukka/run-vcpkg@v11 |
| 67 | + with: |
| 68 | + vcpkgDirectory: 'C:/vcpkg' |
| 69 | + vcpkgGitCommitId: '300239058e33420acd153135b3f6e6b187828992' |
| 70 | + vcpkgJsonGlob: 'vcpkg.json' |
| 71 | + runVcpkgInstall: true |
| 72 | + |
| 73 | + - name: Install Linux GNS Dependencies |
| 74 | + if: matrix.backend.name == 'GNS' && runner.os == 'Linux' |
| 75 | + run: sudo apt update -y && sudo apt install -y libprotobuf-dev protobuf-compiler |
| 76 | + |
| 77 | + - name: Install macOS GNS Dependencies |
| 78 | + if: matrix.backend.name == 'GNS' && runner.os == 'macOS' |
| 79 | + shell: bash |
| 80 | + run: brew install protobuf |
| 81 | + |
| 82 | + - name: Run CMake |
| 83 | + uses: lukka/run-cmake@v10 |
| 84 | + with: |
| 85 | + configurePreset: "nalchi-cd-config" |
| 86 | + configurePresetAdditionalArgs: "['${{matrix.backend.flags}}', '${{matrix.config.flags}}', '${{runner.os == 'Windows' && matrix.backend.name == 'GNS' && '-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake' || ''}}']" |
| 87 | + buildPreset: "nalchi-cd-build" |
| 88 | + packagePreset: "nalchi-cd-pack" |
| 89 | + |
| 90 | + - name: Release |
| 91 | + uses: softprops/action-gh-release@v2 |
| 92 | + if: startsWith(github.ref, 'refs/tags/') |
| 93 | + with: |
| 94 | + files: build/nalchi-*-*-*-*-*.* |
0 commit comments