Merge pull request #70 from victorLV214/dev/CCWang #60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Frontend CI/CD | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'frontend/**' # 只有前端代码变更时才触发 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: | | |
echo "====== Starting Frontend Deployment ======" | |
# 进入项目目录 | |
cd /home/lighthouse/se/cs5351G12/frontend | |
# 拉取最新代码 | |
git pull origin main | |
# 重启 PM2 进程 | |
pm2 reload "frontend" || pm2 start npm --name "frontend" -- run dev | |
echo "====== Frontend Deployment Complete ======" |