Spaces:
Running
Running
| name: Release & Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| release: | |
| name: Release NPM Packages | |
| runs-on: ubuntu-latest | |
| outputs: | |
| published: ${{ steps.changesets.outputs.published }} | |
| publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - 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 --no-frozen-lockfile --recursive | |
| - name: Build Packages | |
| run: pnpm run build:all | |
| - name: Create Release Pull Request or Publish to NPM | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm changeset:version | |
| publish: pnpm changeset:publish | |
| commit: "chore: version packages" | |
| title: "chore: version packages" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| deploy-to-hf: | |
| name: Deploy to Hugging Face Spaces | |
| runs-on: ubuntu-latest | |
| needs: release | |
| # Only run if packages were actually published (new release) | |
| if: needs.release.outputs.published == 'true' | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - 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 --no-frozen-lockfile --recursive | |
| - name: Update cyberpunk dependency to use published version | |
| run: | | |
| # Get the actual version from packages/web/package.json | |
| WEB_VERSION=$(node -p "require('./packages/web/package.json').version") | |
| cd examples/cyberpunk-standalone | |
| # Replace file dependency with published version | |
| sed -i 's/"@lerobot\/web": "file:..\/..\/packages\/web"/"@lerobot\/web": "^'$WEB_VERSION'"/' package.json | |
| echo "Updated cyberpunk package.json to use published version ^$WEB_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: Deploy to Hugging Face Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: git push https://NERDDISCO:[email protected]/spaces/NERDDISCO/LeRobot.js main --force | |