Spaces:
Running
Running
name: Sync to Hugging Face space | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
sync-to-hub: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Update cyberpunk dependency to use published version | |
run: | | |
cd examples/cyberpunk-standalone | |
# Replace workspace dependency with published version | |
sed -i 's/"@lerobot\/web": "workspace:\*"/"@lerobot\/web": "^0.1.1"/' package.json | |
echo "Updated cyberpunk package.json to use published version" | |
- name: Prepare README for HF Space | |
run: | | |
# Create HF Space frontmatter by directly copying from hf_config.yml | |
cat docs/hf_config.yml > README_temp.md | |
echo "" >> README_temp.md | |
cat README.md >> README_temp.md | |
mv README_temp.md README.md | |
- name: Configure git | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Commit HF Space changes | |
run: | | |
git add README.md examples/cyberpunk-standalone/package.json | |
git commit -m "Add HF Space frontmatter and update cyberpunk dependency for deployment" || echo "No changes to commit" | |
- name: Push to hub | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: git push https://NERDDISCO:[email protected]/spaces/NERDDISCO/LeRobot.js main --force | |