使用git checkout脚本
Some checks failed
Deploy Incremental Updates to NEUxiaozhan / deploy (push) Failing after 1s

This commit is contained in:
Ember 2025-01-30 01:05:34 +08:00
parent 1b801883e4
commit e2a393e4be

View File

@ -8,10 +8,20 @@ jobs:
deploy: deploy:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- name: Checkout Repository - name: Deploy Code to Web Root
uses: git.xn--xhq44jb2fzpc.com/ember/checkout@main run: |
# 设置 Git 仓库目录和工作目录
GIT_DIR=/opt/gitea/data/gitea-repositories/ember/front
WORK_TREE=/www/wwwroot/front/public
- name: Sync Files to Web Root # 确保 GIT_DIR 目录存在(首次运行需要手动初始化)
run: rsync -avz --delete ./ $WEB_ROOT if [ ! -d "$GIT_DIR" ]; then
env: git clone --bare https://gitea.xn--xhq44jb2fzpc.com/ember/front.git $GIT_DIR
WEB_ROOT: /www/wwwroot/front/public fi
# 获取最新代码并强制检出到网站根目录
git --git-dir=$GIT_DIR --work-tree=$WORK_TREE fetch origin master
git --git-dir=$GIT_DIR --work-tree=$WORK_TREE reset --hard origin/master
# 可选:记录日志
echo "Code deployed to $WORK_TREE at $(date)" >> /opt/gitea/data/gitea-repositories/ember/front/log/git-deploy.log