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

29 lines
1.0 KiB
YAML

name: Deploy Incremental Updates to NEUxiaozhan
on:
push:
branches:
- master # 触发分支,可以根据需要修改
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Deploy Code to Web Root
shell: bash # ← 这里添加 shell 类型
run: |
# 设置 Git 仓库目录和工作目录
GIT_DIR=/opt/gitea/data/gitea-repositories/ember/front
WORK_TREE=/www/wwwroot/front/public
# 确保 GIT_DIR 目录存在(首次运行需要手动初始化)
if [ ! -d "$GIT_DIR" ]; then
git clone --bare https://git.xn--xhq44jb2fzpc.com/ember/front.git $GIT_DIR
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