1 to 1 implementation of GMTK's rather excellent Unity Tutorial.
In addition, this project has CD configured to auto build the app and deploy it to Vercel using Games-CI
, see
gmtk-unity-tutorial/.github/workflows/cd.yml
Lines 1 to 80 in 7546080
name: Actions 😎 | |
on: | |
push: | |
paths: | |
- Assets/* | |
- Packages/* | |
- ProjectSettings/* | |
- .github/workflows/cd.yml | |
- vercel.json | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
permissions: | |
id-token: write | |
pages: write | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
# Cache | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
# Test | |
# - name: Run tests | |
# uses: game-ci/unity-test-runner@v4 | |
# env: | |
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_FILE }} | |
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
# with: | |
# githubToken: ${{ secrets.GITHUB_TOKEN }} | |
# Build | |
- name: Build project | |
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 | |
# Output | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Build | |
path: build | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Determine if this is a production build | |
id: is-prod | |
run: | | |
if [ ${{ github.ref }} == 'refs/heads/main' ]; then | |
echo "--prod" >> $GITHUB_OUTPUT | |
fi | |
- name: Deploy Project Artifacts to Vercel | |
run: vercel deploy ${{ steps.is-prod.outputs.is-prod }} --local-config vercel.json --token=${{ secrets.VERCEL_TOKEN }} ./build/WebGL/WebGL --yes |