mirror of
https://github.com/rishikanthc/Scriberr.git
synced 2026-06-30 15:57:01 +00:00
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: Deploy Project Website to GitHub Pages
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'web/project-site/**'
|
|
- '.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/project-site/package-lock.json
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24.1'
|
|
|
|
- name: Install swag
|
|
run: go install github.com/swaggo/swag/cmd/swag@latest
|
|
|
|
- name: Generate API documentation
|
|
run: swag init -g server/main.go -o web/project-site/public/api --outputTypes json --dir cmd,internal
|
|
|
|
- name: Install dependencies
|
|
working-directory: web/project-site
|
|
run: npm ci
|
|
|
|
- name: Build project site
|
|
working-directory: web/project-site
|
|
run: npm run build
|
|
|
|
- name: Prepare for deployment
|
|
run: |
|
|
echo "Copying CNAME..."
|
|
cp CNAME web/project-site/dist/CNAME
|
|
echo "Creating 404.html for SPA routing..."
|
|
cp web/project-site/dist/index.html web/project-site/dist/404.html
|
|
|
|
- name: Verify build
|
|
run: |
|
|
echo "Build verification:"
|
|
ls -la web/project-site/dist/
|
|
echo "Verifying key files:"
|
|
test -f web/project-site/dist/index.html && echo "✓ index.html" || echo "✗ index.html missing"
|
|
test -f web/project-site/dist/404.html && echo "✓ 404.html" || echo "✗ 404.html missing"
|
|
test -f web/project-site/dist/CNAME && echo "✓ CNAME" || echo "✗ CNAME missing"
|
|
|
|
- name: Setup GitHub Pages
|
|
uses: actions/configure-pages@v4
|
|
|
|
- name: Upload to GitHub Pages
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: web/project-site/dist
|
|
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|