Files
Scriberr/.github/workflows/project-website.yml
2025-11-24 15:15:29 -08:00

76 lines
1.9 KiB
YAML

name: Deploy Project Website to GitHub Pages
on:
push:
branches: [ main ]
paths:
- 'web/landing/**'
- 'api-docs/**'
- '.github/workflows/project-website.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: web/landing/package-lock.json
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install swag
run: go install github.com/swaggo/swag/cmd/swag@latest
- name: Generate API documentation
run: swag init -g cmd/server/main.go -o api-docs
- name: Install dependencies
working-directory: web/landing
run: npm ci
- name: Build landing site
working-directory: web/landing
run: npm run build
- name: Verify build
run: |
echo "Build verification:"
ls -la docs/
echo "Checking docs structure:"
ls -la docs/docs/ || echo "No docs subdirectory found"
echo "Verifying key files:"
test -f docs/index.html && echo "✓ index.html" || echo "✗ index.html missing"
test -f docs/api.html && echo "✓ api.html" || echo "✗ api.html missing"
test -f docs/docs/intro.html && echo "✓ docs/intro.html" || echo "✗ docs/intro.html missing"
- name: Setup GitHub Pages
uses: actions/configure-pages@v4
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4