forked from genshinsim/gcsim
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (153 loc) · 5.42 KB
/
Copy pathdeploy.yml
File metadata and controls
165 lines (153 loc) · 5.42 KB
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
name: deployment build
on:
workflow_dispatch:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v7
# grab latest sha
- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV}
- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV}
# setup + test go and yarn
- uses: actions/checkout@v3
- name: go-setup-and-test
uses: ./.github/actions/go-setup-and-test
- name: yarn-setup-and-test
uses: ./.github/actions/yarn-setup-and-test
# deploy
- name: deploy-workers
uses: ./.github/actions/deploy-workers
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
# wasm first because it takes the longest
- name: deploy-wasm
uses: ./.github/actions/deploy-wasm
with:
rcloneConfig: ${{ secrets.CF_RCLONE }}
branch: ${{ steps.branch-name.outputs.base_ref_branch }}
shareKey: ${{ secrets.AES_KEY }}
- name: deploy-ui
uses: ./.github/actions/deploy-ui
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# name needs to be "main" if on mainline
branch: ${{ steps.branch-name.outputs.base_ref_branch == 'mainline' && 'main' || steps.branch-name.outputs.base_ref_branch }}
- name: deploy-db
uses: ./.github/actions/deploy-db
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# name needs to be "main" if on mainline
branch: ${{ steps.branch-name.outputs.base_ref_branch == 'mainline' && 'main' || steps.branch-name.outputs.base_ref_branch }}
- name: deploy-docs
uses: ./.github/actions/deploy-docs
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# name needs to be "main" if on mainline
branch: ${{ steps.branch-name.outputs.base_ref_branch == 'mainline' && 'main' || steps.branch-name.outputs.base_ref_branch }}
- name: deploy-taghelper
uses: ./.github/actions/deploy-taghelper
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# name needs to be "main" if on mainline
branch: ${{ steps.branch-name.outputs.base_ref_branch == 'mainline' && 'main' || steps.branch-name.outputs.base_ref_branch }}
# build backend artifacts
- name: build db
uses: ./.github/actions/build-backend-binary
with:
cmd: db
- name: build api gateway
uses: ./.github/actions/build-backend-binary
with:
cmd: jadechamber
- name: build discord bot
uses: ./.github/actions/build-backend-binary
with:
cmd: managerchan
- name: build share store
uses: ./.github/actions/build-backend-binary
with:
cmd: share
- name: build preview generator
uses: ./.github/actions/build-backend-binary
with:
cmd: preview
- name: build notification binary
uses: ./.github/actions/build-backend-binary
with:
cmd: notification
- name: build compute binary
uses: ./.github/actions/build-compute-binary
with:
cmd: compute
# add a file with the hash
- name: save hash to file
working-directory: ./backend/docker
shell: bash
run: |
echo "${LAST_COMMIT_SHA}" >> hash.txt
ls -la
# upload artifacts
- name: upload db artifacts
uses: actions/upload-artifact@v3
with:
name: backend-artifacts
path: ./backend/docker
# organize compute artifacts
- name: organize compute artifacts
shell: bash
run: |
mkdir -p ./computebin
cp ./backend/docker/hash.txt ./computebin/hash.txt
cp ./backend/cmd/compute/compute ./computebin/compute
- name: upload compute artifacts
uses: actions/upload-artifact@v3
with:
name: compute-artifacts
path: ./computebin
- name: git
run: |
git status
#build web site last
- name: Build Binary
run: |
# make file runnable, might not be necessary
chmod +x "${GITHUB_WORKSPACE}/scripts/build.sh"
# run the script
"${GITHUB_WORKSPACE}/scripts/build.sh"
env:
GCSIM_SHARE_KEY: ${{ secrets.AES_KEY }}
- name: Release Binary
uses: softprops/action-gh-release@v1
with:
files: |
LICENSE
gcsim_windows_amd64.exe
gcsim_darwin_arm64
gcsim_darwin_amd64
gcsim_linux_amd64
server_windows_amd64.exe
server_darwin_arm64
server_darwin_amd64
server_linux_amd64