-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (62 loc) · 2.27 KB
/
ci.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
on:
push:
tags:
- 'v*'
name: ielts-ai ci
jobs:
build-and-deploy:
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
sudo apt-get install -y libcurl4-openssl-dev libssl-dev
- name: checkout repository
uses: actions/checkout@v4
- name: Build
run: |
sed -i "s/OSS_ACCESS_ENDPOINT/${{ secrets.OSS_ACCESS_ENDPOINT }}/g" ./conf/auth.yaml
sed -i "s/OSS_ACCESS_KEY_ID/${{ secrets.OSS_ACCESS_KEY_ID }}/g" ./conf/auth.yaml
sed -i "s/OSS_ACCESS_KEY_SECRET/${{ secrets.OSS_ACCESS_KEY_SECRET }}/g" ./conf/auth.yaml
sed -i "s/OPENAI_API_KEY/${{ secrets.OPENAI_API_KEY }}/g" ./conf/auth.yaml
sed -i "s/TOKEN_WX_APPID/${{ secrets.TOKEN_WX_APPID }}/g" ./conf/auth.yaml
sed -i "s/TOKEN_WX_SECRET/${{ secrets.TOKEN_WX_SECRET }}/g" ./conf/auth.yaml
sed -i "s/REDIS_HOST/${{ secrets.REDIS_HOST }}/g" ./conf/redis.yaml
sed -i "s/REDIS_PORT/${{ secrets.REDIS_PORT }}/g" ./conf/redis.yaml
bazel build --action_env=CC=clang-14 //...
mkdir -p output/bin output/conf
mv ./bazel-bin/src/ielts_ai output/bin/
mv ./conf/* output/conf/
- name: Backup old version
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
script: |
mv ${{ secrets.DEPLOY_PATH }} ${{ secrets.DEPLOY_PATH }}.$(date +%Y%m%d_%H%M)
- name: Deploy
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
source: ./output/*
target: ${{ secrets.DEPLOY_PATH }}
strip_components: 1
restart:
name: Restart
needs: build-and-deploy
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
script: |
cd ${{ secrets.DEPLOY_PATH }}
ls -al