0606.10
Some checks failed
Next.js CI/CD 流水线 / deploy (push) Failing after 10m10s

This commit is contained in:
2025-06-06 02:21:23 +08:00
parent 8f1c1bc563
commit 077ed2ab7c
3 changed files with 99 additions and 1 deletions

View File

@@ -16,6 +16,26 @@ jobs:
- name: 📦 检出代码
uses: actions/checkout@v4
# 🧹 清理服务器目标目录 (仅在 main 分支推送时执行)
- name: 🧹 清理服务器目标目录
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
echo "🧹 正在清理目标目录..."
# 确保目录存在
mkdir -p /vol1/1000/Docker/saas2
# 删除目录下所有文件和文件夹(保留目录本身)
rm -rf /vol1/1000/Docker/saas2/*
rm -rf /vol1/1000/Docker/saas2/.[^.]*
echo "✅ 目标目录清理完成"
# 🚚 将项目文件复制到目标服务器 (仅在 main 分支推送时执行)
- name: 🚚 将项目文件复制到目标服务器
if: github.ref == 'refs/heads/main' && github.event_name == 'push'