deleted #16
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: Build and Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| - name: Check Node & NPM | |
| run: | | |
| node -v | |
| npm -v | |
| - name: Install dependencies | |
| run: npm ci || npm install --no-audit --prefer-offline --no-fund | |
| - name: Build and export | |
| run: | | |
| echo "Running build/export" | |
| # Try existing predeploy script (keeps compatibility with project), fall back to build | |
| npm run predeploy || npm run build || true | |
| - name: Inspect output (debug) | |
| run: | | |
| echo "Listing out/ directory" | |
| ls -la out || true | |
| echo "Listing repo root" | |
| ls -la | |
| - name: Add CNAME (optional) | |
| run: | | |
| # Only create a CNAME if the secret is set (avoid using secrets in the step 'if' expression) | |
| if [ -n "${{ secrets.CUSTOM_DOMAIN }}" ]; then | |
| mkdir -p out | |
| printf "%s" "${{ secrets.CUSTOM_DOMAIN }}" > out/CNAME | |
| ls -la out | |
| else | |
| echo "No CUSTOM_DOMAIN secret set; skipping CNAME creation" | |
| fi | |
| - name: Upload artifact to GitHub Pages | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./out | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 | |
| - name: Verify Pages configuration (debug) | |
| run: | | |
| echo "GET Pages API (unauthenticated may 404)" | |
| curl -s -I https://api.github.com/repos/${{ github.repository }}/pages || true | |
| echo "GET Pages API (authenticated)" | |
| curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pages || true | |
| - name: Success message | |
| run: echo "Deployed to GitHub Pages" | |