fix: remove ambiguous unicode chars from workflow yaml
Sync to site1 / sync (push) Has been cancelled

This commit is contained in:
gaojie
2026-05-20 23:26:48 +08:00
parent 622dd91315
commit 7db0c99d48
+7 -41
View File
@@ -1,17 +1,3 @@
# ============================================================
# Gitea Actions Workflow: 同步 worldmodel 内容到 site1
# ============================================================
# 触发条件:push 到 main 分支
# 功能:将 worldmodel 仓库内容同步到 admin/site1 的
# content/posts/worldmodel/ 目录,并触发 Hugo 构建
#
# 前置条件(用户需手动操作):
# 在 Gitea 仓库 gaojie/worldmodel 的
# Settings → Secrets → Actions 里添加:
# Name: SITE1_PASSWORD
# Value: 你的 git.plantshero.com 账号 gaojie 的密码
# ============================================================
name: Sync to site1
on:
@@ -22,7 +8,6 @@ on:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout worldmodel
uses: actions/checkout@v4
@@ -33,24 +18,17 @@ jobs:
env:
SITE1_PASSWORD: ${{ secrets.SITE1_PASSWORD }}
run: |
git clone \
https://gaojie:${SITE1_PASSWORD}@git.plantshero.com/admin/site1.git \
/tmp/site1
# 立即清除 remote URL 中的凭据,避免凭据残留在 git 配置里
git -C /tmp/site1 remote set-url origin \
https://git.plantshero.com/admin/site1.git
git clone https://gaojie:${SITE1_PASSWORD}@git.plantshero.com/admin/site1.git /tmp/site1
git -C /tmp/site1 remote set-url origin https://git.plantshero.com/admin/site1.git
- name: Sync content to site1
- name: Sync content
run: |
# 若目标目录已存在,先用 git rm 清理(保持 git 历史干净)
if [ -d /tmp/site1/content/posts/worldmodel ]; then
git -C /tmp/site1 rm -rf content/posts/worldmodel
fi
mkdir -p /tmp/site1/content/posts/worldmodel
# rsync:排除 .git 及 .gitignore 中列出的产物
rsync -a \
--exclude='.git/' \
--exclude='.git' \
--exclude='node_modules/' \
--exclude='.venv/' \
--exclude='__pycache__/' \
@@ -75,24 +53,12 @@ jobs:
cd /tmp/site1
git config user.name "gitea-actions"
git config user.email "actions@plantshero.com"
git add content/posts/worldmodel
# 若无变更则跳过,workflow 正常退出(exit 0
if git diff --cached --quiet; then
echo "No changes to commit, skipping push."
exit 0
fi
git commit -m "chore(sync): 从 worldmodel 同步内容 @ ${{ github.sha }}"
# 推送时临时注入凭据
git remote set-url origin \
https://gaojie:${SITE1_PASSWORD}@git.plantshero.com/admin/site1.git
git commit -m "chore(sync): sync worldmodel content @ ${{ github.sha }}"
git remote set-url origin https://gaojie:${SITE1_PASSWORD}@git.plantshero.com/admin/site1.git
git push origin main
# 推送完成后立即清除凭据
git remote set-url origin \
https://git.plantshero.com/admin/site1.git
echo "Sync complete. site1 post-receive hook will trigger Hugo build."
git remote set-url origin https://git.plantshero.com/admin/site1.git