Skip to content

Merge pull request #54 from FinTechTonic/quant #4

Merge pull request #54 from FinTechTonic/quant

Merge pull request #54 from FinTechTonic/quant #4

name: Deploy Project Site to GitHub Pages
on:
push:
branches:
- main
paths:
- 'project-site/**'
- '.github/workflows/deploy-project-site.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: project-site/package-lock.json
- name: Install dependencies
working-directory: ./project-site
run: npm ci
- name: Build project site
working-directory: ./project-site
env:
GITHUB_REPOSITORY: ${{ github.repository }}
run: npm run build
- name: Create .nojekyll file
working-directory: ./project-site
run: touch dist/.nojekyll
- name: Verify build output
working-directory: ./project-site
run: |
echo "Build output contents:"
ls -lah dist/
echo ""
echo "Checking for index.html:"
test -f dist/index.html || (echo "ERROR: index.html not found!" && exit 1)
echo "Checking artifact size:"
du -sh dist/
echo "File count:"
find dist -type f | wc -l
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: './project-site/dist'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
timeout-minutes: 15
steps:
- name: Wait for any stuck deployments to timeout
run: |
echo "Waiting 30 seconds for any stuck deployments to timeout..."
sleep 30
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
continue-on-error: true
- name: Retry deployment if conflicted
if: steps.deployment.outcome == 'failure'
run: |
echo "Previous deployment failed, waiting 60 seconds and retrying..."
sleep 60
- name: Deploy to GitHub Pages (retry)
if: steps.deployment.outcome == 'failure'
id: deployment_retry
uses: actions/deploy-pages@v4