|
| 1 | +name: Deploy Frontend to GitHub Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - .github/workflows/pages-frontend.yml |
| 9 | + - frontend/taskdeck-web/src/** |
| 10 | + - frontend/taskdeck-web/public/** |
| 11 | + - frontend/taskdeck-web/index.html |
| 12 | + - frontend/taskdeck-web/package.json |
| 13 | + - frontend/taskdeck-web/tailwind.config.js |
| 14 | + - frontend/taskdeck-web/vite.config.ts |
| 15 | + - frontend/taskdeck-web/tsconfig*.json |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + pages: write |
| 21 | + id-token: write |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: pages |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + build: |
| 29 | + name: Build Frontend |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Setup Node |
| 36 | + uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version: '24' |
| 39 | + cache: npm |
| 40 | + cache-dependency-path: frontend/taskdeck-web/package-lock.json |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + working-directory: frontend/taskdeck-web |
| 44 | + run: npm ci |
| 45 | + |
| 46 | + - name: Build |
| 47 | + working-directory: frontend/taskdeck-web |
| 48 | + run: npx vite build --base /Taskdeck/ |
| 49 | + env: |
| 50 | + VITE_API_BASE_URL: '' |
| 51 | + |
| 52 | + - name: SPA fallback for client-side routing |
| 53 | + run: cp frontend/taskdeck-web/dist/index.html frontend/taskdeck-web/dist/404.html |
| 54 | + |
| 55 | + - name: Configure GitHub Pages |
| 56 | + uses: actions/configure-pages@v5 |
| 57 | + |
| 58 | + - name: Upload Pages artifact |
| 59 | + uses: actions/upload-pages-artifact@v3 |
| 60 | + with: |
| 61 | + path: frontend/taskdeck-web/dist |
| 62 | + |
| 63 | + deploy: |
| 64 | + name: Deploy to GitHub Pages |
| 65 | + needs: build |
| 66 | + runs-on: ubuntu-latest |
| 67 | + environment: |
| 68 | + name: github-pages |
| 69 | + url: ${{ steps.deployment.outputs.page_url }} |
| 70 | + steps: |
| 71 | + - name: Deploy |
| 72 | + id: deployment |
| 73 | + uses: actions/deploy-pages@v4 |
0 commit comments