2025-02-13 21:11:08 +01:00

78 lines
2.1 KiB
YAML

name: Deploy Next.js site to Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
cd web
npm ci
- name: Ensure required dependencies are installed
run: |
cd web
npm list next-themes || npm install next-themes
npm list @radix-ui/react-accordion || npm install @radix-ui/react-accordion
npm list @radix-ui/react-alert-dialog || npm install @radix-ui/react-alert-dialog
npm list @radix-ui/react-aspect-ratio || npm install @radix-ui/react-aspect-ratio
- name: Verify dependencies installation
run: |
cd web
if [ -d "node_modules/next-themes" ] && [ -d "node_modules/@radix-ui/react-accordion" ] && [ -d "node_modules/@radix-ui/react-alert-dialog" ] && [ -d "node_modules/@radix-ui/react-aspect-ratio" ]; then
echo "✅ All required dependencies are installed!"
else
echo "❌ ERROR: Some dependencies are missing!"
exit 1
fi
- name: Build Next.js project
run: |
cd web
npm run build
- name: Copy guides and changelog
run: |
mkdir -p web/out/guides
cp -r guides/*.md web/out/guides/ || echo "No guides found"
cp CHANGELOG.md web/out/ || echo "No CHANGELOG.md found"
- name: Upload artifact to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: web/out
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4