Skip to content

feat: align frontend data contract and mobile UX #46

feat: align frontend data contract and mobile UX

feat: align frontend data contract and mobile UX #46

Workflow file for this run

name: Deploy to GitHub Pages and Convex
on:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# 1. Checkout code
- name: Checkout
uses: actions/checkout@v4
# 2. Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
# 3. Install dependencies
- name: Install dependencies
run: npm ci
# 4. Deploy to Convex FIRST (generates _generated files and captures URL)
- name: Deploy to Convex
id: deploy-convex
env:
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }}
run: |
# Deploy and capture the full output
OUTPUT=$(npx convex deploy 2>&1) || true
echo "$OUTPUT"
# Extract URL - Convex outputs the deployment URL in various formats
CONVEX_URL=$(echo "$OUTPUT" | grep -oE 'https://[a-zA-Z0-9-]+\.convex\.cloud' | head -1)
# Fallback: check if URL is in the standard format
if [ -z "$CONVEX_URL" ]; then
CONVEX_URL=$(echo "$OUTPUT" | grep -oE 'https://[^ ]+convex\.cloud[^ ]*' | head -1)
fi
if [ -z "$CONVEX_URL" ]; then
echo "ERROR: Could not extract Convex URL from deployment output"
echo "Full output was:"
echo "$OUTPUT"
exit 1
fi
echo "Extracted Convex URL: $CONVEX_URL"
echo "convex_url=$CONVEX_URL" >> $GITHUB_OUTPUT
# 5. Build frontend AFTER Convex deployment (with URL baked into static bundle)
- name: Build Next.js site
env:
NEXT_PUBLIC_CONVEX_URL: ${{ steps.deploy-convex.outputs.convex_url }}
run: |
echo "Building with NEXT_PUBLIC_CONVEX_URL=$NEXT_PUBLIC_CONVEX_URL"
if [ -z "$NEXT_PUBLIC_CONVEX_URL" ]; then
echo "ERROR: NEXT_PUBLIC_CONVEX_URL is empty!"
exit 1
fi
npm run build
# 6. Upload build artifacts to GitHub Pages
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './out'
# 7. Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4