Some checks failed
Deploy Frontend / build-and-deploy (push) Failing after 59s
The frontend uses pnpm workspaces with 'workspace:*' protocol that npm doesn't support. This updates the workflow to: - Install pnpm using pnpm/action-setup - Use pnpm for install, sync-schemas, generate-manifest, and build - Cache pnpm dependencies using pnpm-lock.yaml
127 lines
4 KiB
YAML
127 lines
4 KiB
YAML
# GLAM Frontend Deployment
|
|
# Automatically builds and deploys frontend to bronhouder.nl when changes are pushed
|
|
#
|
|
# Triggered by:
|
|
# - Any changes to frontend/ directory
|
|
# - Any changes to schemas/20251121/linkml/ directory (LinkML schema updates)
|
|
# - Manual workflow dispatch
|
|
#
|
|
# This workflow:
|
|
# 1. Syncs LinkML schemas to frontend/public
|
|
# 2. Regenerates the schema manifest (for LinkML viewer)
|
|
# 3. Builds the frontend (Vite/React)
|
|
# 4. Deploys to server via rsync
|
|
|
|
name: Deploy Frontend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'frontend/**'
|
|
- 'schemas/20251121/linkml/**'
|
|
- '.forgejo/workflows/deploy-frontend.yml'
|
|
|
|
# Allow manual trigger
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
NODE_VERSION: '20'
|
|
PNPM_VERSION: '9'
|
|
SERVER_IP: '91.98.224.44'
|
|
SERVER_USER: 'root'
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository (sparse)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
frontend
|
|
schemas
|
|
sparse-checkout-cone-mode: false
|
|
|
|
- name: Install pnpm
|
|
uses: https://github.com/pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ env.PNPM_VERSION }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'pnpm'
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
working-directory: frontend
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Sync LinkML schemas to frontend
|
|
working-directory: frontend
|
|
run: pnpm run sync-schemas
|
|
|
|
- name: Generate schema manifest
|
|
working-directory: frontend
|
|
run: pnpm run generate-manifest
|
|
|
|
- name: Build frontend
|
|
working-directory: frontend
|
|
run: pnpm run build
|
|
env:
|
|
VITE_OXIGRAPH_URL: https://bronhouder.nl
|
|
|
|
- name: Setup SSH key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
|
|
chmod 600 ~/.ssh/deploy_key
|
|
ssh-keyscan -H ${{ env.SERVER_IP }} >> ~/.ssh/known_hosts 2>/dev/null || true
|
|
|
|
- name: Deploy frontend to server
|
|
run: |
|
|
echo "Deploying frontend build to server..."
|
|
rsync -avz --progress --delete \
|
|
-e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no" \
|
|
frontend/dist/ \
|
|
${{ env.SERVER_USER }}@${{ env.SERVER_IP }}:/var/www/glam-frontend/
|
|
|
|
- name: Verify deployment
|
|
run: |
|
|
echo "Verifying deployment..."
|
|
|
|
# Check that Caddy is serving the frontend
|
|
HTTP_STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://bronhouder.nl/)
|
|
|
|
if [ "$HTTP_STATUS" = "200" ]; then
|
|
echo "Frontend deployment verified: OK (HTTP $HTTP_STATUS)"
|
|
else
|
|
echo "Warning: Frontend returned HTTP $HTTP_STATUS"
|
|
fi
|
|
|
|
# Check manifest is accessible
|
|
MANIFEST_STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://bronhouder.nl/schemas/20251121/linkml/manifest.json)
|
|
|
|
if [ "$MANIFEST_STATUS" = "200" ]; then
|
|
echo "Schema manifest accessible: OK"
|
|
# Show file count from manifest
|
|
curl -s https://bronhouder.nl/schemas/20251121/linkml/manifest.json | jq '.totalFiles' | xargs -I {} echo "Total schema files: {}"
|
|
else
|
|
echo "Warning: Schema manifest returned HTTP $MANIFEST_STATUS"
|
|
fi
|
|
|
|
- name: Deployment summary
|
|
run: |
|
|
echo "============================================"
|
|
echo " Frontend Deployment Complete!"
|
|
echo "============================================"
|
|
echo ""
|
|
echo "Server: ${{ env.SERVER_IP }}"
|
|
echo "Frontend URL: https://bronhouder.nl/"
|
|
echo "LinkML Viewer: https://bronhouder.nl/linkml"
|
|
echo "Schema Manifest: https://bronhouder.nl/schemas/20251121/linkml/manifest.json"
|
|
echo ""
|