Some checks failed
Deploy Incremental Updates to NEUxiaozhan / deploy (push) Failing after 0s
35 lines
928 B
YAML
35 lines
928 B
YAML
name: Deploy Incremental Updates to NEUxiaozhan
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Deploy Incremental Updates
|
|
shell: bash
|
|
run: |
|
|
REPO_PATH="/opt/gitea/data/gitea-repositories/ember/front.git"
|
|
WEB_ROOT="/www/wwwroot/front/public"
|
|
|
|
# 进入仓库目录
|
|
cd "$REPO_PATH"
|
|
|
|
# 获取最新代码
|
|
git fetch origin master
|
|
|
|
# 获取最新提交和上一次提交的差异
|
|
LAST_COMMIT=$(git rev-parse HEAD)
|
|
git reset --hard origin/master
|
|
CURRENT_COMMIT=$(git rev-parse HEAD)
|
|
|
|
echo "Syncing changes from $LAST_COMMIT to $CURRENT_COMMIT"
|
|
|
|
# 获取变更文件并同步
|
|
rsync -av --delete --files-from=<(git diff --name-only $LAST_COMMIT $CURRENT_COMMIT) "$REPO_PATH/" "$WEB_ROOT/"
|
|
|
|
echo "Deployment completed!"
|