CI 全流程自动化:测试通过后自动部署到 VPS

This commit is contained in:
2569718930@qq.com
2026-05-19 13:24:02 +08:00
parent e56040a855
commit 3c013e300a
+18
View File
@@ -62,3 +62,21 @@ jobs:
- name: Build Docker image
run: docker build -t polyweather-ci .
deploy:
needs: [python-quality, frontend-quality, docker-build]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Deploy to VPS
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
script: |
cd /root/PolyWeather
git pull origin main
docker compose up -d --build
sleep 10
curl -s http://localhost:8000/healthz