Sync to HuggingFace Space #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync to HuggingFace Space | |
| on: | |
| workflow_run: | |
| workflows: ["Deploy Visual Report to GitHub Pages"] | |
| types: [completed] | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: hf-space | |
| # When triggered by the Pages workflow, download its build artifact | |
| - name: Download site artifact | |
| if: github.event_name == 'workflow_run' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site-content | |
| path: _site | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| # When triggered manually, fetch the published site | |
| - name: Fetch published site | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| mkdir -p _site/grasp _site/g1-reach _site/g1-loco \ | |
| _site/g1-native-groot _site/g1-native-sonic _site/sonic-planner _site/sonic | |
| BASE=https://miaodx.com/roboharness | |
| curl -fsSL "$BASE/" -o _site/index.html | |
| curl -fsSL "$BASE/grasp/index.html" -o _site/grasp/index.html | |
| curl -fsSL "$BASE/g1-reach/index.html" -o _site/g1-reach/index.html | |
| curl -fsSL "$BASE/g1-loco/index.html" -o _site/g1-loco/index.html | |
| curl -fsSL "$BASE/g1-native-groot/index.html" -o _site/g1-native-groot/index.html | |
| curl -fsSL "$BASE/g1-native-sonic/index.html" -o _site/g1-native-sonic/index.html | |
| curl -fsSL "$BASE/sonic-planner/index.html" -o _site/sonic-planner/index.html | |
| curl -fsSL "$BASE/sonic/index.html" -o _site/sonic/index.html | |
| - name: Add Space metadata | |
| run: cp hf-space/README.md _site/README.md | |
| - name: Mirror site to Hugging Face Space | |
| uses: huggingface/hub-sync@v0.1.0 | |
| with: | |
| github_repo_id: MiaoDX/roboharness | |
| subdirectory: _site | |
| huggingface_repo_id: miaodongxu/roboharness-demo | |
| hf_token: ${{ secrets.HF_TOKEN }} | |
| repo_type: space | |
| space_sdk: static |