Skip to content

revert to old

revert to old #40

Workflow file for this run

on:
push:
branches: ["main"]
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