Skip to content

Fix Vercel deployment configuration for monorepo #18

Fix Vercel deployment configuration for monorepo

Fix Vercel deployment configuration for monorepo #18

Workflow file for this run

name: Test & Deploy
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
permissions:
contents: read
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
# -------------------------
# Server: test & build (COMMENTED OUT FOR DEBUGGING)
# -------------------------
# test-server:
# name: Test Server
# runs-on: ubuntu-latest
# timeout-minutes: 20
# env:
# CI: true
# ADMIN_SECRET: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# - name: Install, lint, test, build
# working-directory: server
# run: |
# npm ci
# npm run lint
# npm test
# npm run build
# - name: Upload server build
# uses: actions/upload-artifact@v4
# with:
# name: server-build
# path: server/dist
# -------------------------
# Mobile: test Flutter web build (COMMENTED OUT FOR DEBUGGING)
# -------------------------
# test-mobile:
# name: Test Mobile (Flutter Web)
# runs-on: ubuntu-latest
# timeout-minutes: 20
# env:
# CI: true
# steps:
# - uses: actions/checkout@v4
# - uses: subosito/flutter-action@v2
# with:
# flutter-version: 3.35.3
# channel: stable
# cache: true
# - name: Ensure Flutter web is enabled
# working-directory: mobile
# run: flutter config --enable-web
# - name: Setup environment file
# run: cp mobile/.env.example mobile/.env
# - name: Test mobile app
# working-directory: mobile
# run: |
# flutter pub get
# flutter analyze
# flutter test
# flutter build web --release --no-wasm-dry-run
# - name: Upload web build
# uses: actions/upload-artifact@v4
# with:
# name: web-build
# path: mobile/build/web
# -------------------------
# Server: deploy (requires BOTH tests, only on main)
# -------------------------
deploy-server:
name: Deploy Server (traceoffapi)
runs-on: ubuntu-latest
# needs: [test-server, test-mobile] # COMMENTED OUT FOR DEBUGGING
if: github.ref == 'refs/heads/main'
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_API_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} # optional for Personal
VERCEL_TELEMETRY_DISABLED: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
# Deploy from server directory
- name: Vercel pull (production)
working-directory: server
run: npx vercel pull --yes --environment=production --token="$VERCEL_TOKEN"
- name: Deploy to Vercel (prod)
working-directory: server
run: npx vercel deploy --prod --yes --token="$VERCEL_TOKEN"
# -------------------------
# Web: build & deploy Flutter web (requires BOTH tests, only on main)
# -------------------------
deploy-web:
name: Deploy Flutter Web (traceoff)
runs-on: ubuntu-latest
# needs: [test-server, test-mobile] # COMMENTED OUT FOR DEBUGGING
if: github.ref == 'refs/heads/main'
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_WEB_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} # optional
VERCEL_TELEMETRY_DISABLED: "1"
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: 3.35.3
channel: stable
cache: true
- name: Ensure Flutter web is enabled + scaffold web runner if missing
working-directory: mobile
run: |
flutter config --enable-web
if [ ! -d "web" ]; then
flutter create . --platforms web
fi
- name: Provide web env file for assets
run: cp mobile/.env.example mobile/.env
- name: Build Flutter Web
working-directory: mobile
run: |
flutter pub get
flutter build web --release --no-wasm-dry-run
- uses: actions/setup-node@v4
with:
node-version: 20
# Deploy using Vercel CLI from mobile directory
- name: Vercel pull (production)
working-directory: mobile
run: npx vercel pull --yes --environment=production --token="$VERCEL_TOKEN"
- name: Deploy built web to Vercel (prod)
working-directory: mobile
run: npx vercel deploy build/web --prod --yes --token="$VERCEL_TOKEN"