taskpilot / .github /workflows /deploy-hf.yml
github-actions[bot]
Sync repository to Hugging Face Space
f689c7d
Raw History Blame Contribute Delete
1.7 kB
name: Sync to Hugging Face Hub
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v5
- name: Set up Java 25
uses: actions/setup-java@v5
with:
java-version: "25"
distribution: "temurin"
cache: "maven"
- name: Run Maven Tests
run: mvn clean test -B
- name: Test Docker Build (Hugging Face Space verification)
run: docker build -t taskpilot-hf-test .
sync-to-hub:
needs: build-and-test
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all history for git info
- name: Push to Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git remote add hf https://taskpilot952476:$HF_TOKEN@huggingface.co/spaces/taskpilot952476/taskpilot
# Hugging Face Hub rejects binary docs assets in this repository history.
# Build a clean orphan commit that excludes docs implementation assets.
git checkout --orphan hf-sync
git rm -rf --cached .
git add .
git rm -r --cached --ignore-unmatch docs/implementation
git commit -m "Sync repository to Hugging Face Space"
git push -f hf HEAD:main