forked from blocktest-game/blocktest
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (74 loc) · 2.59 KB
/
build.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
name: Build project
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
prepareBuild:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
steps:
- name: Create Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: true
buildForAllSupportedPlatforms:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
needs: prepareBuild
strategy:
fail-fast: false
matrix:
projectPath:
- Blocktest
targetPlatform:
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
- StandaloneWindows # Build a Windows standalone.
- StandaloneWindows64 # Build a Windows 64-bit standalone.
- StandaloneLinux64 # Build a Linux 64-bit standalone.
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: actions/cache@v2
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- name: Setup license
env:
LICENSE_FILE_PATH: ./.github/License.ulf
run: |
echo 'UNITY_LICENSE<<LICENSE-EOF' >> "$GITHUB_ENV"
cat "$LICENSE_FILE_PATH" >> "$GITHUB_ENV"
printf "\nLICENSE-EOF" >> "$GITHUB_ENV"
- uses: game-ci/unity-builder@v2
id: build
with:
unityVersion: 2020.2.5f1
projectPath: ${{ matrix.projectPath }}
targetPlatform: ${{ matrix.targetPlatform }}
- name: Zip build
run: |
pushd build/${{ matrix.targetPlatform }}
zip -r ../../Build-${{ matrix.targetPlatform }}.zip .
popd
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepareBuild.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Build-${{ matrix.targetPlatform }}.zip
asset_name: Build-${{ matrix.targetPlatform }}.zip
asset_content_type: application/zip