Skip to content

.github/workflows/main.yml #87

.github/workflows/main.yml

.github/workflows/main.yml #87

Workflow file for this run

name: Build and Deploy to Pages
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Configure Pages
uses: actions/configure-pages@v4
# Ensure a build script exists
- name: Verify build script
run: |
if ! npm run | grep -qE '^ build'; then
echo "ERROR: No npm 'build' script found."
echo "Add a build script to package.json (e.g. Vite: \"build\": \"vite build\", Next: \"build\": \"next build && next export\")."
exit 1
fi
- name: Install dependencies
run: npm ci
- name: Build site
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs
name: github-pages-${{ github.run_id }}-${{ github.run_attempt }}
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages-${{ github.run_id }}-${{ github.run_attempt }}