feat: 更新前端部署工作流,优化文件管理和验证步骤
- 修改了目标目录为临时目录`/tmp/frontend-build`,并在部署后将文件移动到生产目录`/home/gitea/www/photography/`。 - 新增了创建目标目录、清空旧文件、移动新文件、清理临时文件和验证部署结果的步骤,提升了部署的可靠性和可维护性。 此更改增强了前端部署的流程和文件管理。
This commit is contained in:
@ -110,9 +110,35 @@ jobs:
|
||||
password: ${{ secrets.ALIYUN_PWD }}
|
||||
port: 22
|
||||
source: "frontend/out/"
|
||||
target: "/home/gitea/www/photography/"
|
||||
target: "/tmp/frontend-build"
|
||||
rm: true
|
||||
|
||||
- name: 🔄 部署文件到生产目录
|
||||
uses: appleboy/ssh-action@v1.0.0
|
||||
with:
|
||||
host: ${{ secrets.ALIYUN_IP }}
|
||||
username: ${{ secrets.ALIYUN_USER_NAME }}
|
||||
password: ${{ secrets.ALIYUN_PWD }}
|
||||
port: 22
|
||||
script: |
|
||||
echo "🔄 部署文件到生产目录..."
|
||||
|
||||
# 创建目标目录
|
||||
mkdir -p /home/gitea/www/photography
|
||||
|
||||
# 清空旧文件
|
||||
rm -rf /home/gitea/www/photography/*
|
||||
|
||||
# 移动新文件到生产目录
|
||||
cp -r /tmp/frontend-build/frontend/out/* /home/gitea/www/photography/ || exit 1
|
||||
|
||||
# 清理临时文件
|
||||
rm -rf /tmp/frontend-build
|
||||
|
||||
# 验证部署结果
|
||||
echo "📋 验证部署文件..."
|
||||
ls -la /home/gitea/www/photography/ | head -10
|
||||
|
||||
- name: 🔧 设置文件权限
|
||||
uses: appleboy/ssh-action@v1.0.0
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user