Skip to content

Build

Build #23

Workflow file for this run

name: Build
run-name: Build
on:
workflow_dispatch:
inputs:
build_version:
description: "Build version:"
required: true
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions: write-all
jobs:
build-macos:
name: Build webGL
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
# Checkout the project repository into ${{github.workspace}}/project
- name: Checkout Unity project repository
uses: actions/checkout@v4
with:
path: project
fetch-depth: 0
# Cache Library folder
- name: Use Library Cache
uses: actions/cache@v3
with:
path: project/Library
key: library-webgl
# Build WebGL standalone
- name: Build WebGL v${{github.event.inputs.build_version}}
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
versioning: Custom
version: ${{github.event.inputs.build_version}}
projectPath: project
# Commit and push branch
- name: Tag, commit and push branch
run: |
cd ${{github.workspace}}/project/
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git pull
git checkout -b release/${{github.event.inputs.build_version}}
git add ${{github.workspace}}/project/ProjectSettings/ProjectSettings.asset
git commit -m "Update release version to ${{github.event.inputs.build_version}}"
git push origin release/${{github.event.inputs.build_version}}
# Tag and delete the release branch.
- name: Tag and delete branch
run: |
cd ${{github.workspace}}/project/
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git fetch
git tag "${{github.event.inputs.build_version}}"
git push --tags origin release/${{github.event.inputs.build_version}}
git checkout main
git merge --no-ff release/${{github.event.inputs.build_version}}
git push origin main
git push origin --delete release/${{github.event.inputs.build_version}}
# Upload to itch.io
- name: Upload to itch.io
uses: robpc/itchio-upload-action@v1
with:
path: build/
project: wobblewares/chameleon
channel: webgl
version: ${{github.event.inputs.build_version}}
api-key: ${{ secrets.ITCH_API_KEY }}