Files
worldmodel/.gitea/workflows/sync-to-site1.yml
T
gaojie 7db0c99d48
Sync to site1 / sync (push) Has been cancelled
fix: remove ambiguous unicode chars from workflow yaml
2026-05-20 23:26:48 +08:00

65 lines
2.1 KiB
YAML

name: Sync to site1
on:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout worldmodel
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Clone site1
env:
SITE1_PASSWORD: ${{ secrets.SITE1_PASSWORD }}
run: |
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
run: |
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 -a \
--exclude='.git' \
--exclude='node_modules/' \
--exclude='.venv/' \
--exclude='__pycache__/' \
--exclude='*.pyc' \
--exclude='.DS_Store' \
--exclude='.pytest_cache/' \
--exclude='.mypy_cache/' \
--exclude='.ruff_cache/' \
--exclude='.idea/' \
--exclude='.vscode/' \
--exclude='*.log' \
--exclude='plans/PRISM/.build/' \
--exclude='PRISM_*.pdf' \
--exclude='research/lyra2_paper.pdf' \
--exclude='.gitea/' \
./ /tmp/site1/content/posts/worldmodel/
- name: Commit and push site1
env:
SITE1_PASSWORD: ${{ secrets.SITE1_PASSWORD }}
run: |
cd /tmp/site1
git config user.name "gitea-actions"
git config user.email "actions@plantshero.com"
git add content/posts/worldmodel
if git diff --cached --quiet; then
echo "No changes to commit, skipping push."
exit 0
fi
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