-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (85 loc) · 2.97 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Build Action
on: [push]
jobs:
test:
name: Test project
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
# Cache
- uses: actions/cache@v4
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 }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
# Build
build:
name: Build project
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
# Cache
- uses: actions/cache@v4
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
# 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
allowDirtyBuild: true # Change this to recommended solution later https://game.ci/docs/troubleshooting/common-issues/#branch-is-dirty
# Output
- uses: actions/upload-artifact@v4
with:
name: Build
path: build
deployToGitHubPages:
# from: https://davidmfinol.com/gameci-3_linux.html#:~:text=the%20release%20notes.-,Deploy%20to%20the%20Web%20via%20GitHub%20Pages,-deployToGitHubPages%3A%0A%20%20%20%20name
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build #Only run after new build is completed
#if: github.event.action == 'published' || (contains(github.event.inputs.workflow_mode, 'release') && contains(github.event.inputs.workflow_mode, 'WebGL')) #run on a publish event?
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download WebGL Artifact
uses: actions/download-artifact@v4
with:
name: Build
path: build
- name: Copy the WebGL build artifacts to the GitHub Pages directory
env:
WEBGL_BUILD_PATH: ${{ format('{0}/build/WebGL/WebGL/.', github.workspace) }}
WEBGL_PAGES_PATH: ${{ format('{0}/docs', github.workspace) }}
run: cp -r $WEBGL_BUILD_PATH $WEBGL_PAGES_PATH; #OR: rsync -r $WEBGL_BUILD_PATH $WEBGL_PAGES_PATH
- name: Deploy to GitHub Pages
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
file_pattern: docs/**
commit_message: Deploy to GitHub Pages