Added basic CI/CD infrastructure. #2
This file contains 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: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
# ----------------------------------------------------------------------- Checkout | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# ----------------------------------------------------------------------- Restore library cache | ||
- name: Restore library cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: Library | ||
key: Library-${{hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**')}} | ||
restore-keys: | | ||
Library- | ||
# ----------------------------------------------------------------------- Build | ||
- name: Build | ||
uses: game-ci/unity-builder@v4 | ||
env: | ||
UNITY_LICENSE: ${{secrets.UNITY_LICENSE}} | ||
UNITY_EMAIL: ${{secrets.UNITY_EMAIL}} | ||
UNITY_PASSWORD: ${{secrets.UNITY_PASSWORD}} | ||
with: | ||
targetPlatform: WebGL | ||
buildsPath: Build | ||
# ----------------------------------------------------------------------- Collect artifacts | ||
- name: Collect build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Build-WebGL | ||
if-no-files-found: error | ||
path: Build | ||
- name: Collect GitHub Pages artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
path: Build | ||
# ----------------------------------------------------------------------- Deploy to GitHub Pages | ||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v4 | ||