-
Notifications
You must be signed in to change notification settings - Fork 159
220 lines (197 loc) · 7.26 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: Build and Release
on:
push:
branches:
- main
- development
- preview
- release/*
- fast-track/*
tags: [ "*" ]
pull_request:
types: [ ready_for_review, opened, reopened, auto_merge_enabled ]
workflow_dispatch:
inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
jobs:
build:
name: Build for ${{ matrix.targetPlatform }}
runs-on:
group: linux-8cores
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
projectPath:
- nekoyume
targetPlatform:
- StandaloneWindows
- StandaloneLinux64
- StandaloneOSX
steps:
- uses: actions/checkout@v3
with:
lfs: true
submodules: true
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-ubuntu-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-ubuntu-
Library-
- uses: game-ci/unity-builder@v4
with:
projectPath: ${{ matrix.projectPath }}
targetPlatform: ${{ matrix.targetPlatform }}
buildMethod: 'NekoyumeEditor.Builder.Build${{ matrix.targetPlatform }}'
buildName: ${{ matrix.targetPlatform }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.0
- name: Move Folder
run: |
sudo mv $GITHUB_WORKSPACE/build /tmp/player
- name: Pack
run: |
targetPlatform=${{ matrix.targetPlatform }}
pip3 install wheel
sudo bash .github/bin/pack.sh \
/tmp/packages \
"${{ matrix.targetPlatform }}" \
"/tmp/player"
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: /tmp/packages
retention-days: 7
if-no-files-found: error
extract:
if: (startsWith(github.ref, 'refs/heads/release/')
|| github.ref == 'refs/heads/preview'
|| startsWith(github.event.ref, 'refs/tags/')
)
needs: build
runs-on: ubuntu-latest
outputs:
network: ${{ steps.extract.outputs.network }}
signing: ${{ steps.extract.outputs.signing }}
version: ${{ steps.extract.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: extract
id: extract
run: |
timestamp=$(date +%s)
major=${timestamp:0:4}
minor=${timestamp:4:3}
patch=${timestamp:7:3}
semver="${major}.${minor}.${patch}"
if [[ "${{ startsWith(github.ref, 'refs/heads/release/') }}" == "true" ]]; then
echo "::set-output name=network::internal"
echo "::set-output name=signing::--no-signing"
echo "::set-output name=version::$semver"
elif [[ "${{ github.ref == 'refs/heads/preview' }}" == "true" ]]; then
echo "::set-output name=network::preview"
echo "::set-output name=signing::--no-signing"
echo "::set-output name=version::$semver"
elif [[ "${{ startsWith(github.event.ref, 'refs/tags/') }}" == "true" ]]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "::set-output name=network::main"
echo "::set-output name=signing::--signing"
echo "::set-output name=version::$TAG_NAME"
else
echo "::set-output name=network::null"
echo "::set-output name=signing::null"
echo "::set-output name=version::null"
fi
release:
if: (startsWith(github.ref, 'refs/heads/release/')
|| github.ref == 'refs/heads/preview'
|| startsWith(github.event.ref, 'refs/tags/')
)
runs-on: ubuntu-20.04
strategy:
matrix:
targetPlatform:
- Windows
- macOS
- Linux
needs: extract
environment:
name: ${{ needs.extract.outputs.network }}
permissions:
id-token: write
contents: read
outputs:
version: ${{ needs.extract.outputs.version }}
network: ${{ needs.extract.outputs.network }}
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GitHubActions-${{ github.run_id }}
role-duration-seconds: 1200
aws-region: ap-northeast-2
- name: release
uses: planetarium/9c-toolbelt@main
with:
COMMAND_LIST: "release|player|${{ github.sha }}|${{ needs.extract.outputs.version }}|${{ needs.extract.outputs.network }}|${{ matrix.targetPlatform }}|${{ needs.extract.outputs.signing }}|--slack-channel=${{ secrets.SLACK_CHANNEL }}|--run-id=${{ github.run_id }}"
ENV: production
GITHUB_TOKEN: ${{ secrets.P_GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
NAVER_CLOUD_ACCESS_KEY: ${{ secrets.NAVER_CLOUD_ACCESS_KEY }}
NAVER_CLOUD_SECRET_KEY: ${{ secrets.NAVER_CLOUD_SECRET_KEY }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
ESIGNER_CREDENTIAL_ID: ${{ secrets.ESIGNER_CREDENTIAL_ID }}
ESIGNER_USERNAME: ${{ secrets.ESIGNER_USERNAME }}
ESIGNER_PASSWORD: ${{ secrets.ESIGNER_PASSWORD }}
ESIGNER_TOTP_SECRET: ${{ secrets.ESIGNER_TOTP_SECRET }}
update-latest-metadata:
if: (startsWith(github.ref, 'refs/heads/release/')
|| github.ref == 'refs/heads/preview'
|| startsWith(github.event.ref, 'refs/tags/')
)
runs-on: ubuntu-20.04
needs: [ extract, release ]
environment:
name: ${{ needs.extract.outputs.network }}
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GitHubActions-${{ github.run_id }}
role-duration-seconds: 1200
aws-region: ap-northeast-2
- name: update-latest-metadata
uses: planetarium/9c-toolbelt@main
with:
COMMAND_LIST: "release|update-latest|${{ github.sha }}|${{ needs.extract.outputs.version }}|${{ needs.extract.outputs.network }}|--slack-channel=${{ secrets.SLACK_CHANNEL }}"
ENV: production
GITHUB_TOKEN: ${{ secrets.P_GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
NAVER_CLOUD_ACCESS_KEY: ${{ secrets.NAVER_CLOUD_ACCESS_KEY }}
NAVER_CLOUD_SECRET_KEY: ${{ secrets.NAVER_CLOUD_SECRET_KEY }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}