-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (120 loc) · 3.99 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
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
name: compile webGL
on:
push:
branches:
- main
jobs:
# front
webgl_job:
name: compile webgl unity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache
# - uses: actions/cache@v2
# with:
# path: Library
# key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
# restore-keys: |
# Library-
- uses: game-ci/unity-builder@v2
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
targetPlatform: WebGL
- name: Create deployment artifact
env:
GITHUB_SHA: ${{ github.sha }}
run: |
tar -czf "${GITHUB_SHA}".tar.gz --exclude=*.git --exclude=node_modules build/WebGL
- name: Store artifact for distribution
uses: actions/upload-artifact@v2
with:
name: Build-WebGL
path: ${{ github.sha }}.tar.gz
prepare-release-on-servers_webgl:
name: Prepare release webgl
runs-on: ubuntu-latest
needs: webgl_job
steps:
- uses: actions/download-artifact@v2
with:
name: Build-WebGL
- name: Upload
uses: appleboy/scp-action@master
with:
host: ${{ secrets.QA_HOST_FRONTEND }}
username: ${{ secrets.QA_HOST_FE_USERNAME }}
password: ${{ secrets.QA_HOST_FE_PASSWORD }}
source: ${{ github.sha }}.tar.gz
target: artifacts
- name: connect server
uses: appleboy/ssh-action@master
env:
GITHUB_SHA: ${{ github.sha }}
with:
host: ${{ secrets.QA_HOST_FRONTEND }}
username: ${{ secrets.QA_HOST_FE_USERNAME }}
password: ${{ secrets.QA_HOST_FE_PASSWORD }}
envs: GITHUB_SHA
script: |
mkdir -p "releases/${GITHUB_SHA}"
tar xzf artifacts/${GITHUB_SHA}.tar.gz -C "releases/${GITHUB_SHA}"
rm -r /var/www/webgl/* 2> /dev/null
cp -r releases/${GITHUB_SHA}/build/WebGL/WebGL/* /var/www/webgl/
# server
server_job:
name: compile server unix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: game-ci/unity-builder@v2
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
targetPlatform: StandaloneLinux64
customParameters: -EnableHeadlessMode
- name: Create deployment artifact
env:
GITHUB_SHA: ${{ github.sha }}
run: |
tar -czf "${GITHUB_SHA}".tar.gz --exclude=*.git --exclude=node_modules build/StandaloneLinux64
- uses: actions/upload-artifact@v2
with:
name: Build-Linux-Server
path: ${{ github.sha }}.tar.gz
prepare-release-on-servers_unity:
name: Prepare release unity
runs-on: ubuntu-latest
needs: server_job
steps:
- uses: actions/download-artifact@v2
with:
name: Build-Linux-Server
- name: Upload
uses: appleboy/scp-action@master
with:
host: ${{ secrets.QA_HOST_UNITY }}
username: ${{ secrets.QA_HOST_USERNAME }}
password: ${{ secrets.QA_HOST_PASSWORD }}
source: ${{ github.sha }}.tar.gz
target: artifacts
- name: connect server
uses: appleboy/ssh-action@master
env:
GITHUB_SHA: ${{ github.sha }}
with:
host: ${{ secrets.QA_HOST_UNITY }}
username: ${{ secrets.QA_HOST_USERNAME }}
password: ${{ secrets.QA_HOST_PASSWORD }}
envs: GITHUB_SHA
script: |
mkdir -p "releases/${GITHUB_SHA}"
tar xzf artifacts/${GITHUB_SHA}.tar.gz -C "releases/${GITHUB_SHA}"
rm -r server 2>/dev/null
mkdir server
cp -r releases/${GITHUB_SHA}/build/StandaloneLinux64/* server