-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
294 lines (261 loc) · 8.88 KB
/
qbot-release.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
name: Qbot-Build-Release
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "**.spec.js"
- ".idea"
- ".vscode"
- ".dockerignore"
- "Dockerfile"
- ".gitignore"
- ".github/**"
- "!.github/workflows/qbot-release.yml"
tags:
- v*
jobs:
fund_strategy_release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
python-version: [3.8]
environment: fund_strategy
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: Cache Node Dependencies
id: cache
uses: actions/cache@v1
with:
path: node_modules
key: ${{runner.OS}}-npm-caches-${{ hashFiles('package-lock.json') }}
- name: Install Dependencies
run: |
cd $GITHUB_WORKSPACE/pyfunds/fund-strategies
npm install
- name: Build Release Files
run: |
cd $GITHUB_WORKSPACE/pyfunds/fund-strategies
npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: release_on_${{ matrix.os }}
path: dist/
retention-days: 5
# - name: 'Publish to the npm registry'
# uses: primer/publish@3.0.0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# with:
# default_branch: 'main'
release:
name: Create Release
runs-on: ${{ matrix.os }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
strategy:
matrix:
# os: [ubuntu-20.04, macos-11.0, windows-2019]
os: [macos-11.0]
python-version: [3.8]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
draft: true
prerelease: true
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
investool_app_release:
runs-on: ubuntu-latest
needs: release
timeout-minutes: 15
env:
tag_name: v1.0.0
release_name: investool_app_ubuntu_$tag_name
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
# - name: Test
# run: go test -race ./...
- name: Build For Mac
run: |
cd $GITHUB_WORKSPACE/investool
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/axiaoxin-com/investool/version.Version=`TZ=Asia/Shanghai date +'%y%m%d%H%M'`" -o investool_app_mac
- name: Tar [Mac]
run: |
cd $GITHUB_WORKSPACE/investool
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' 's/env = "localhost"/env = "prod"/' config.toml
else
sed -i "s/env = \"localhost\"/env = \"prod\"/g" config.toml
fi
tar czvf investool_app_mac.tar.gz investool_app_mac config.toml
- name: Build For Linux
run: |
cd $GITHUB_WORKSPACE/investool
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X github.com/axiaoxin-com/investool/version.Version=`TZ=Asia/Shanghai date +'%y%m%d%H%M'`" -o investool_app_linux
- name: Tar [Linux]
run: |
cd $GITHUB_WORKSPACE/investool
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' 's/env = "localhost"/env = "prod"/' config.toml
else
sed -i "s/env = \"localhost\"/env = \"prod\"/g" config.toml
fi
tar czvf investool_app_linux.tar.gz investool_app_linux config.toml
- name: Build For Win
run: |
cd $GITHUB_WORKSPACE/investool
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/axiaoxin-com/investool/version.Version=`TZ=Asia/Shanghai date +'%y%m%d%H%M'`" -o investool_app_win
- name: Tar [Win]
run: |
cd $GITHUB_WORKSPACE/investool
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' 's/env = "localhost"/env = "prod"/' config.toml
else
sed -i "s/env = \"localhost\"/env = \"prod\"/g" config.toml
fi
tar czvf investool_app_win.tar.gz investool_app_win config.toml
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
tag_name: ${{ github.ref }}
- name: Upload assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: $GITHUB_WORKSPACE/investool/investool_app_mac.tar.gz
asset_name: investool_app_mac.tar.gz
asset_content_type: application/gzip
# - name: SCP Files
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USER }}
# port: ${{ secrets.REMOTE_PORT }}
# key: ${{ secrets.SERVER_SSH_KEY }}
# source: 'investool_app_mac.tar.gz, investool_app_linux.tar.gz, investool_app_win.tar.gz'
# target: ${{ secrets.REMOTE_TARGET }}
# - name: SSH Remote Commands
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USER }}
# port: ${{ secrets.REMOTE_PORT }}
# key: ${{ secrets.SERVER_SSH_KEY }}
# script: ${{ secrets.AFTER_COMMAND }}
qbot_build:
name: Build Qbot
needs: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11.0, windows-2019]
python-version: [3.8]
env:
tag_name: v1.0.0
release_name: qbot_${{ matrix.os}}_$tag_name
steps:
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build
run: |
pyinstaller -F -w --clean --add-data gui/bkt_result/bkt_result.html:gui/bkt_result/bkt_result.html --add-data gui/imgs/wechat.png:gui/imgs/wechat.png main.py -n qbot --icon=./gui/imgs/logo.ico
- name: Package
working-directory: .
run: |
tar -zcvf ${release_name}.tar.gz ./dist
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
tag_name: ${{ github.ref }}
- name: Upload assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${release_name}.tar.gz
asset_name: ${release_name}.tar.gz
asset_content_type: application/gzip
qbot_package:
name: Package Qbot all
needs: [qbot_build, investool_app_release, fund_strategy_release]
runs-on: ${{ matrix.os }}
env:
tag_name: v1.0.0
release_name: qbot_${{ matrix.os}}_$tag_name
defaults:
run:
working-directory: Qbot
strategy:
matrix:
os: [ubuntu-20.04, macos-11.0, windows-2019]
python-version: [3.8]
steps:
- name: Package ${{ matrix.python-version }} ${{ matrix.os }}
working-directory: .
run: |
mv *.tar.gz *.zip qbot_${{ matrix.os }}_release
tar -zcvf qbot_${{ matrix.os }}_release_${release_name}.tar.gz qbot_${{ matrix.os }}_release/*
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
tag_name: ${{ github.ref }}
- name: Upload assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: qbot_${{ matrix.os }}_release_${release_name}.tar.gz
asset_name: qbot_${{ matrix.os }}_release_${release_name}.tar.gz
asset_content_type: application/gzip