Skip to content

Commit

Permalink
Separate unity build and web server
Browse files Browse the repository at this point in the history
  • Loading branch information
SeoulSKY committed Dec 28, 2023
1 parent 0713666 commit 40cce58
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 40 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/docker-unity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build Unity WebGL

on:
push:
branches:
- master

jobs:
docker-web:
environment: desdemona
runs-on: ubuntu-latest

steps:

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: false
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Checkout code
uses: actions/checkout@v3

- name: Cache Unity Dependencies
uses: actions/cache@v2
with:
path: ./desdemona/Library
key: Library-desdemona-WebGL
restore-keys: |
Library-desdemona-
Library-
- name: Build Unity project
uses: game-ci/unity-builder@v3
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: WebGL
projectPath: desdemona
buildMethod: Commands.Builder.Build

- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: Build
path: desdemona/Builds/WebGL/Build

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get Repository Name in Lowercase
id: repo_name
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: web-server
platforms: linux/amd64,linux/arm64/v8
push: true
tags: |
ghcr.io/${{ steps.repo_name.outputs.lowercase }}-web:latest
40 changes: 0 additions & 40 deletions .github/workflows/docker-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,9 @@ jobs:

steps:

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: false
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Checkout code
uses: actions/checkout@v3

- name: Cache Unity Dependencies
uses: actions/cache@v2
with:
path: ./desdemona/Library
key: Library-desdemona-WebGL
restore-keys: |
Library-desdemona-
Library-
- name: Build Unity project
uses: game-ci/unity-builder@v3
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: WebGL
projectPath: desdemona
buildMethod: Commands.Builder.Build

- name: Copy the build to the right location
run: |
chmod 755 web-server/public && cp -r desdemona/Builds/WebGL/Build web-server/public/Build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down

0 comments on commit 40cce58

Please sign in to comment.