Skip to content

docs: update README #58

docs: update README

docs: update README #58

Workflow file for this run

name: Sync Demo Branch
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sync-demo:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create demo branch if it doesn't exist
run: |
if ! git ls-remote --heads origin demo | grep -q demo; then
echo "Creating demo branch..."
git checkout -b demo
git push origin demo
else
echo "Demo branch already exists"
fi
- name: Checkout demo branch
uses: actions/checkout@v4
with:
ref: demo
token: ${{ secrets.GITHUB_TOKEN }}
path: demo
- name: Clean demo directory
run: |
cd demo
find . -mindepth 1 -path './.git' -prune -o -exec rm -rf {} + 2>/dev/null || true
- name: Copy files using config
run: |
yq eval '.sync[] | .source + ":" + .dest' .github/sync-config.yml | while IFS=: read -r src dst; do
src=$(echo "$src" | xargs)
dst=$(echo "$dst" | xargs)
[ -z "$src" ] && continue
if [ -e "$src" ]; then
target_path="demo/$dst"
# 处理目录(以/结尾或本身是目录)
if [[ "$dst" == */ ]] || [ -d "$src" ]; then
mkdir -p "$target_path"
# 复制目录里的内容,而不是目录本身
cp -r "$src"/* "$target_path"
echo "Copied $src/* → $target_path"
else
mkdir -p "$(dirname "$target_path")"
cp "$src" "$target_path"
echo "Copied $src → $target_path"
fi
else
echo "Source not found: $src"
fi
done
- name: Commit and push changes
run: |
cd demo
git config --global user.email "actions@github.com"
git config --global user.name "github-actions[bot]"
# 检查是否有变化
if [[ -n $(git status --porcelain) ]]; then
git add .
git commit -m "Auto-sync demo branch with main branch"
git push origin demo
echo "Changes pushed to demo branch"
else
echo "No changes to sync"
fi
push-hf:
needs: sync-demo
uses: ./.github/workflows/push-to-hf.yml
secrets:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
push-ms:
needs: sync-demo
uses: ./.github/workflows/push-to-ms.yml
secrets:
MS_TOKEN: ${{ secrets.MS_TOKEN }}
with:
ref: demo