diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..2aa17a8b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: 部署秋秋的家 + +on: + push: + branches: [ main ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: 拉取代码 + uses: actions/checkout@v3 + + - name: 部署到服务器 + uses: appleboy/ssh-action@master + with: + host: $ secrets.ZZ_SERVER_HOST + username: $ secrets.ZZ_SERVER_USER + key: $ secrets.ZZ_SERVER_KEY + script: | + cd $ secrets.ZZ_SERVER_PATH /qiuqiu || mkdir -p $ secrets.ZZ_SERVER_PATH /qiuqiu && cd $ secrets.ZZ_SERVER_PATH /qiuqiu + git pull origin main || git clone https://github.com/zhizhi200271/guanghulab.git . + npm install + export ZZ_LLM_API_KEY=$ secrets.ZZ_LLM_API_KEY + export ZZ_LLM_BASE_URL=$ secrets.ZZ_LLM_BASE_URL + pm2 restart qiuqiu || pm2 start server.js --name qiuqiu --env production + pm2 save + echo "🍂 秋秋的家部署完成!"