forked from planetarium/NineChronicles
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (146 loc) · 5.19 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
on:
push:
branches: []
tags: ["*"]
name: Build
jobs:
build-unity:
name: Build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- nekoyume
unityVersion:
- 2020.3.4f1
targetPlatform:
- Windows
- macOS
- Linux
steps:
- name: Set environment variables
run: |
targetPlatform=${{ matrix.targetPlatform }}
if [ "$targetPlatform" == "Windows" ]; then
echo "DOCKER_IMAGE_TAG=${{ matrix.unityVersion }}-windows-mono-0.11" >> $GITHUB_ENV
elif [ "$targetPlatform" == "macOS" ]; then
echo "DOCKER_IMAGE_TAG=${{ matrix.unityVersion }}-mac-mono-0.11" >> $GITHUB_ENV
elif [ "$targetPlatform" == "Linux" ]; then
echo "DOCKER_IMAGE_TAG=${{ matrix.unityVersion }}-linux-il2cpp-1.0" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
with:
lfs: true
submodules: true
- uses: actions/cache@v2
with:
path: ${{ matrix.projectPath }}/Library
key: ${{ matrix.targetPlatform }}-${{ matrix.projectPath }}-Library-v4
- name: inject mixpanel client data
run: |
TARGET_NETWORK=$(case "$GITHUB_REF" in
refs/heads/main)
echo -n "mainnet"
;;
refs/heads/rc-*)
echo -n "internal"
;;
refs/heads/previewnet)
echo -n "previewnet"
;;
*)
echo -n "unknown"
;;
esac)
chmod +x .github/bin/inject-mixpanel-client-data.sh
.github/bin/inject-mixpanel-client-data.sh \
"$GITHUB_SHA" \
"$TARGET_NETWORK"
- name: Build Unity Player using docker
run: |
docker run \
--env ULF="${{ secrets.ULF_2020_3_0_F1 }}" \
-w "${{ github.workspace }}" \
-v "${{ github.workspace }}":"${{ github.workspace }}" \
unityci/editor:${DOCKER_IMAGE_TAG} \
scripts/build-player.sh ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v2
with:
name: 9c-${{ matrix.targetPlatform }}
path: nekoyume/Build/${{ matrix.targetPlatform }}
retention-days: 1
if-no-files-found: error
publish:
name: Publish Unity Player for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- Windows
- macOS
- Linux
needs: build-unity
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/heads/rc-') || github.ref == 'refs/heads/previewnet' || github.ref == 'refs/heads/2022q2' }}
steps:
- uses: actions/checkout@v2
- id: download_player
uses: actions/download-artifact@v2
with:
name: 9c-${{ matrix.targetPlatform }}
path: /tmp/player
- name: Set up Python # FIXME: 나중에 내장 파이썬 버전이 3.7 이상으로 올라가면 삭제할 것
uses: actions/setup-python@v2
with:
python-version: 3.8.6
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.201"
- name: Pack
run: |
set -evx
mkdir -p $HOME/.local/bin
npm config set prefix $HOME/.local/bin
export PATH="$HOME/.local/bin:$PATH"
npm install --global strip-json-comments-cli
dotnet tool install \
--global \
Libplanet.Tools
# macOS 내장 date는 ISO 8601 서식 옵션이 따로 없음
timestamp="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
pip3 install wheel
.github/bin/pack.sh \
/tmp/package \
"${{ matrix.targetPlatform }}" \
"${{ steps.download_player.outputs.download-path }}" \
"${{ secrets.APV_SIGNING_PRIVATE_KEY }}" \
"$timestamp"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- uses: chrnorm/deployment-action@releases/v1
id: build_artifact
with:
token: ${{ secrets.GITHUB_TOKEN }}
description: "Build artifact"
environment: build-artifact
- run: mv /tmp/package ./package # s3-upload-action이 상대 경로만 지원
if: success()
shell: bash
- uses: shallwefootball/s3-upload-action@master
if: success()
with:
source_dir: package
destination_dir: ${{ github.sha }}
aws_bucket: 9c-artifacts
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
target_url: ${{ steps.S3.outputs.object_locations[0] }}
state: "success"
deployment_id: ${{ steps.build_artifact.outputs.deployment_id }}