-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (51 loc) · 1.75 KB
/
ci.yaml
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
name: quant-tool-build
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
# 后续可以改成自己的服务器
runs-on: ubuntu-latest
steps:
# 拉取对应代码
- uses: actions/checkout@v3
- name: docker build
run: |
docker build . --file Dockerfile -t quant-toolbox:v0.$GITHUB_RUN_NUMBER --platform=linux/amd64
docker save -o quant-toolbox.tar.gz quant-toolbox:v0.$GITHUB_RUN_NUMBER
- uses: actions/upload-artifact@v3
with:
name: quant-toolbox.tar.gz
path: ./quant-toolbox.tar.gz
- uses: actions/upload-artifact@v3
with:
name: deploy.sh
path: ./deploy.sh
deploy:
needs: [build]
env:
DEPLOY_HOST: ${{ secrets.TENCENT_HOST }}
DEPLOY_KEY: ${{ secrets.TENCENT_PRI_KEY }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: quant-toolbox.tar.gz
- uses: actions/download-artifact@v3
with:
name: deploy.sh
- name: RSyncer Action
uses: Pendect/[email protected]
with:
flags: '-avzrP --delete'
options: ''
ssh_options: ''
src: './'
dest: 'work@${DEPLOY_HOST}:/home/work/artifact/quant-toolbox'
- name: Display status from deploy
run: echo "${{ steps.deploy.outputs.status }}"
- name: deploy quant-toolbox
run: |
mkdir -p ~/.ssh/ && echo "${DEPLOY_KEY}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
ssh -o StrictHostKeyChecking=no work@${DEPLOY_HOST} "cd /home/work/artifact/quant-toolbox && sh deploy.sh"