Skip to content

Use upload-pages-artifact + deploy-pages workflow with debug steps #8

Use upload-pages-artifact + deploy-pages workflow with debug steps

Use upload-pages-artifact + deploy-pages workflow with debug steps #8

Workflow file for this run

name: Build and Deploy to GitHub Pages

Check failure on line 1 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy.yml

Invalid workflow file

(Line: 50, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.CUSTOM_DOMAIN != ''
on:
push:
branches:
- main
# Explicit permissions so the workflow can publish to GitHub Pages
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)
if: secrets.CUSTOM_DOMAIN != ''
run: |
mkdir -p out
echo "${{ secrets.CUSTOM_DOMAIN }}" > out/CNAME
ls -la out
- 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"