Skip to content

Build and Deploy WebGL #3

Build and Deploy WebGL

Build and Deploy WebGL #3

Workflow file for this run

name: Build and Deploy WebGL
on:
workflow_dispatch:
push:
branches:
- main
paths:
- Assets/**
- Packages/**
- ProjectSettings/**
- web/**
- README.md
- .github/workflows/webgl-pages.yml
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: webgl-pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Build WebGL project
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
unityVersion: auto
targetPlatform: WebGL
buildMethod: BuildScript.BuildWebGLForPages
- name: Add .nojekyll marker
run: touch Build/WebGL/.nojekyll
- name: Prepare showcase site artifact
run: |
rm -rf site-dist
mkdir -p site-dist/unity
cp -R web/. site-dist/
cp -R Build/WebGL/. site-dist/unity/
touch site-dist/.nojekyll
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site-dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4