fix github pages workflow #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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build | |
| run: npm run build | |
| - name: Debug build output | |
| run: | | |
| echo "Root files:" | |
| ls -la | |
| echo "Dist files:" | |
| ls -la dist || true | |
| echo "Dist client files:" | |
| ls -la dist/client || true | |
| - name: Copy SPA fallback | |
| run: | | |
| if [ -f dist/client/index.html ]; then | |
| cp dist/client/index.html dist/client/404.html | |
| elif [ -f dist/index.html ]; then | |
| cp dist/index.html dist/404.html | |
| else | |
| echo "No index.html found" | |
| find dist -maxdepth 3 -type f | |
| exit 1 | |
| fi | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist/client | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |