-
Notifications
You must be signed in to change notification settings - Fork 4
98 lines (85 loc) · 3.59 KB
/
main.yml
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
93
94
95
96
97
name: Release on Main 😎
on:
# This allows for manual triggering of the action
workflow_dispatch:
# This will run this action on every push to the main branch - update as required
push:
branches:
- main
jobs:
build-project:
name: Build project ✨
runs-on: ubuntu-latest
# Enter in project properties here
env:
PROJECT_NAME: github-karts
strategy:
fail-fast: false
matrix:
targetPlatform: # These are the definitions from: https://docs.unity3d.com/ScriptReference/BuildTarget.html
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
- StandaloneWindows64 # Build a Windows 64-bit standalone.
- StandaloneLinux64 # Build a Linux 64-bit standalone
- WebGL # Build for WebGL
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true
# Cache
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
# Build
- name: Build project
uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
## Use below variables for Professional Serial
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
buildName: ${{ env.PROJECT_NAME }}
# We manually compress the MacOS build, as uploading as an Artifact causes issues on MacOS
- name: Compress Build (MacOS)
if: matrix.targetPlatform == 'StandaloneOSX'
run: |
pushd build/${{ matrix.targetPlatform }}
sudo zip -r ${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip ./${{ env.PROJECT_NAME }}.app
popd
sudo mv build/${{ matrix.targetPlatform }}/${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip build/${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip
- name: Compress Build
if: matrix.targetPlatform != 'StandaloneOSX'
run: |
pushd build/${{ matrix.targetPlatform }}
sudo zip -r ${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip ./*
popd
sudo mv build/${{ matrix.targetPlatform }}/${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip build/${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip
# Upload Artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}
path: build/${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip
#Upload to Pages (For WebGL builds)
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
if: matrix.targetPlatform == 'WebGL'
with:
branch: gh-pages # The branch the action should deploy to.
folder: build/WebGL/${{ env.PROJECT_NAME }} # The folder the action should deploy.
# More details on usage here: https://github.com/marketplace/actions/create-release
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
tag: "0.0.1" # Or what ever tag you want, but there must be a tag!
body: "Pre-release"
artifacts: 'build/${{ env.PROJECT_NAME }}-${{ matrix.targetPlatform }}.zip'
token: ${{ secrets.GITHUB_TOKEN }}