Skip to content

feat: Build in CI

feat: Build in CI #8

Workflow file for this run

name: Build Sentaur Survivors
on:
push:
branches:
- main
pull_request:
workflow_dispatch: # e.g. to manually trigger on foreign PRs
env:
UNITY_VERSION: '6000.1.12f1'
jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
with:
access_token: ${{ github.token }}
build:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- targetPlatform: StandaloneWindows64
os: windows-latest
- targetPlatform: Android
os: ubuntu-latest
- targetPlatform: StandaloneLinux64
os: ubuntu-latest
steps:
- name: Free disk space
if: matrix.os == 'ubuntu-latest'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
df -h
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Cache Unity Library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-${{ matrix.targetPlatform }}-
Library-
- name: Cache Build Output
uses: actions/cache@v4
id: cache-build
with:
path: build
key: Build-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Build-${{ matrix.targetPlatform }}-
- run: echo "::add-mask::${{ secrets.LICENSE_SERVER_URL }}"
- uses: game-ci/unity-builder@v4
if: steps.cache-build.outputs.cache-hit != 'true'
with:
unityVersion: ${{ env.UNITY_VERSION }}
targetPlatform: ${{ matrix.targetPlatform }}
unityLicensingServer: ${{ secrets.LICENSE_SERVER_URL }}
buildName: SentaurSurvivors-${{ matrix.targetPlatform }}
customParameters: -dsn ${{ secrets.DSN }} -auth_token ${{ secrets.AUTH_TOKEN }}
allowDirtyBuild: true
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: Build-${{ matrix.targetPlatform }}
path: build
retention-days: 14
run-demo:
name: Run Demo
needs: [build]
uses: ./.github/workflows/run-demo.yml