This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (123 loc) · 3.47 KB
/
build.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build & Release
on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- closed
jobs:
cancel-concurent-run:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
create-tag:
name: Create tag
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
outputs:
tag: ${{ steps.version.outputs.new-tag }}
steps:
# Tag
- name: Tag creation
uses: phish108/autotag-action@1.1.37
with:
github-token: ${{ secrets.GITHUB_TOKEN}}
dry-run: "true"
id: version
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
targetPlatform:
- StandaloneWindows
- StandaloneWindows64
- StandaloneLinux64
outputs:
targetPlatform: ${{ matrix.targetPlatform }}
needs: [create-tag]
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
# Cache
- uses: actions/cache@v2
with:
path: |
Library
build
key: Library
restore-keys: Library
# Build
- name: Build project
uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
allowDirtyBuild: true
# Zip
- name: Zip build
run: |
pushd build/${{ matrix.targetPlatform }}
zip -r ../../Build-${{ matrix.targetPlatform }}-${{ needs.create-tag.outputs.tag }}.zip .
popd
# Output Zip
- uses: actions/upload-artifact@v2
with:
name: Build-${{ matrix.targetPlatform }}-${{ needs.create-tag.outputs.tag }}.zip
path: ./Build-${{ matrix.targetPlatform }}-${{ needs.create-tag.outputs.tag }}.zip
create-release:
name: Release
runs-on: ubuntu-latest
needs: [create-tag, build]
outputs:
release_url: ${{ steps.release.outputs.upload_url }}
steps:
# Release
- name: Create Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.create-tag.outputs.tag }}
release_name: Release ${{ needs.create-tag.outputs.tag }}
draft: false
prerelease: false
upload-release:
name: Upload
runs-on: ubuntu-latest
needs: [build, create-release, create-tag]
strategy:
matrix:
targetPlatform:
- StandaloneWindows
- StandaloneWindows64
- StandaloneLinux64
steps:
# Load zip
- name: Load zip
uses: actions/download-artifact@v1
with:
name: Build-${{ matrix.targetPlatform }}-${{ needs.create-tag.outputs.tag }}.zip
path: ./
#Upload
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.release_url }}
asset_path: ./Build-${{ matrix.targetPlatform }}-${{ needs.create-tag.outputs.tag }}.zip
asset_name: Build-${{ matrix.targetPlatform }}-${{ needs.create-tag.outputs.tag }}.zip
asset_content_type: application/zip