Skip to content

add landing page and huggingface space demo #1

add landing page and huggingface space demo

add landing page and huggingface space demo #1

Workflow file for this run

name: Deploy to Hugging Face Space
on:
push:
branches: ["master"]
workflow_dispatch: # 允许手动触发
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Export requirements.txt
run: |
uv export --no-hashes --no-dev -o requirements.txt
- name: Prepare deployment files
run: |
# 创建临时部署目录
mkdir -p /tmp/hf-deploy
# 复制必要文件到部署目录
cp examples/app.py /tmp/hf-deploy/app.py
cp requirements.txt /tmp/hf-deploy/
cp -r src /tmp/hf-deploy/
cp README.md /tmp/hf-deploy/ || echo "README.md not found, skipping"
cp LICENSE /tmp/hf-deploy/ || echo "LICENSE not found, skipping"
# 创建 .gitignore for HF Space
cat > /tmp/hf-deploy/.gitignore << 'EOF'
__pycache__/
*.py[cod]
.venv/
*.mov
*.mp4
outputs/
inputs/
EOF
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: bbruceyuan
HF_SPACE_NAME: auto-chapter-bar
run: |
cd /tmp/hf-deploy
# 配置 git
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# 初始化 git 仓库
git init
git checkout -b main
# 添加所有文件
git add .
git commit -m "Deploy from GitHub Actions - $(date +'%Y-%m-%d %H:%M:%S')"
# 推送到 Hugging Face
git remote add hf https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}
git push -f hf main