feat: migrate workflow template site as apps/hub #3
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: Hub Preview | |
| on: | |
| pull_request: | |
| paths: | |
| - 'apps/hub/**' | |
| workflow_dispatch: | |
| concurrency: | |
| group: hub-preview-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| preview: | |
| runs-on: ubuntu-latest | |
| env: | |
| SKIP_AI_GENERATION: 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup frontend | |
| uses: ./.github/actions/setup-frontend | |
| - name: Checkout templates data | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Comfy-Org/workflow_templates | |
| path: _workflow_templates | |
| sparse-checkout: templates | |
| token: ${{ secrets.GH_TOKEN }} | |
| - name: Restore content cache | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: apps/hub/.content-cache | |
| key: hub-content-cache-preview-${{ hashFiles('_workflow_templates/templates/**', 'apps/hub/src/**') }} | |
| restore-keys: | | |
| hub-content-cache-preview- | |
| - name: Sync templates | |
| run: pnpm run sync:en-only | |
| working-directory: apps/hub | |
| env: | |
| HUB_TEMPLATES_DIR: ${{ github.workspace }}/_workflow_templates/templates | |
| - name: Build Astro site | |
| run: pnpm run build | |
| working-directory: apps/hub | |
| env: | |
| PUBLIC_HUB_API_URL: ${{ secrets.HUB_API_URL_PREVIEW }} | |
| PUBLIC_COMFY_CLOUD_URL: ${{ secrets.COMFY_CLOUD_URL_PREVIEW }} | |
| - name: Deploy preview to Vercel | |
| id: deploy | |
| uses: amondnet/vercel-action@16e87c0a08142b0d0d33b76aeaf20823c381b9b9 # v25.2.0 | |
| with: | |
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel-project-id: ${{ secrets.HUB_VERCEL_PROJECT_ID }} | |
| working-directory: apps/hub | |
| vercel-args: '--prebuilt' | |
| - name: Comment preview URL | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 | |
| with: | |
| header: hub-vercel-preview | |
| message: | | |
| 🚀 **Hub preview deployed:** ${{ steps.deploy.outputs.preview-url }} |