front/.gitea/workflows/buildsite.yaml
Ember cd36bd824a
Some checks failed
Deploy Incremental Updates to NEUxiaozhan / deploy (push) Has been cancelled
使用git checkout脚本
2025-01-30 01:30:51 +08:00

55 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Deploy Incremental Updates to NEUxiaozhan
on:
push:
branches: [master]
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Prepare workspace
shell: bash
run: |
# 设置本地仓库路径(根据实际路径调整)
LOCAL_REPO="/opt/gitea/data/gitea-repositories/ember/front.git"
WORKSPACE="/tmp/gitea_workflow"
# 创建临时工作区
mkdir -p $WORKSPACE
cd $WORKSPACE
# 克隆本地仓库使用bare repo
git clone $LOCAL_REPO .
- name: Get changed files
id: changed-files
shell: bash
run: |
cd /tmp/gitea_workflow
# 处理首次提交的情况
if git rev-parse HEAD^ >/dev/null 2>&1; then
git diff --name-only HEAD^ HEAD > changed_files.txt
else
git ls-files > changed_files.txt
fi
# 生成绝对路径文件列表
sed -i "s|^|$WORKSPACE/|" changed_files.txt
echo "CHANGED_FILES=/tmp/gitea_workflow/changed_files.txt" >> $GITHUB_ENV
- name: Sync changes
shell: bash
run: |
# 创建目标目录
sudo mkdir -p /www/wwwroot/front/public
# 带权限同步使用sudo保留权限
sudo rsync -av --chown=www-data:www-data \
--files-from=$CHANGED_FILES \
/tmp/gitea_workflow/ \
/www/wwwroot/front/public/
# 清理临时文件
rm -rf /tmp/gitea_workflow