Spaces:
Running
Running
| name: Deploy to HF Space | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-hf-space | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| # No build step (HF builds the Docker image). Just a cheap syntax | |
| # gate so we never ship a server that won't boot. | |
| - name: Syntax check | |
| run: for f in server/*.js; do node --check "$f"; done | |
| # Unit tests (built-in node:test runner, no deps). Gates the | |
| # deploy: the `deploy` job `needs: validate`, so a red test | |
| # blocks the push to the Space. | |
| - name: Run tests | |
| run: npm test | |
| deploy: | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Mirror this repo to the Space. The Space is a deploy target, so | |
| # a force push is expected (its history is disposable). | |
| - name: Push to Hugging Face Space | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| git config user.email "ci@github-actions" | |
| git config user.name "github-actions" | |
| # Token auth: the username part of the URL is ignored by HF, | |
| # only HF_TOKEN authenticates. Space target is fixed. | |
| git push --force "https://pollen-robotics:${HF_TOKEN}@huggingface.co/spaces/pollen-robotics/reachy-mini-api.git" HEAD:main | |