From b83c37b977e5da9c55a3678ea59b3ceaadec42f9 Mon Sep 17 00:00:00 2001 From: Torben Sorensen Date: Tue, 17 Feb 2026 21:44:34 -0800 Subject: [PATCH] deploy fixes --- .env.example | 2 ++ .gitea/workflows/deploy-to-test.yml | 20 ++++++++++++++++++-- docs/getting-started/ENVIRONMENT.md | 2 ++ vite.config.ts | 17 +++++++++++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index b79d859c..f71edd62 100644 --- a/.env.example +++ b/.env.example @@ -59,6 +59,8 @@ GITHUB_CLIENT_SECRET= # AI/ML Services # =================== # REQUIRED: Google Gemini API key for flyer OCR processing +# NOTE: Test/staging environment deliberately OMITS this to preserve free API quota. +# Production has a working key. Deploy warnings in test are expected and safe to ignore. GEMINI_API_KEY=your-gemini-api-key # =================== diff --git a/.gitea/workflows/deploy-to-test.yml b/.gitea/workflows/deploy-to-test.yml index 178eddef..3bad6d26 100644 --- a/.gitea/workflows/deploy-to-test.yml +++ b/.gitea/workflows/deploy-to-test.yml @@ -81,8 +81,24 @@ jobs: - name: TypeScript Type-Check run: npm run type-check - - name: Prettier Check - run: npx prettier --check . || true + - name: Prettier Auto-Fix + run: | + echo "--- Running Prettier auto-fix for test/staging deployment ---" + # Auto-format all files + npx prettier --write . + + # Check if any files were changed + if ! git diff --quiet; then + echo "📝 Prettier made formatting changes. Committing..." + git config --global user.name 'Gitea Actions' + git config --global user.email 'actions@gitea.projectium.com' + git add . + git commit -m "style: auto-format code via Prettier [skip ci]" + git push + echo "✅ Formatting changes committed and pushed." + else + echo "✅ No formatting changes needed." + fi - name: Lint Check run: npm run lint || true diff --git a/docs/getting-started/ENVIRONMENT.md b/docs/getting-started/ENVIRONMENT.md index ec3606bd..2953fdf6 100644 --- a/docs/getting-started/ENVIRONMENT.md +++ b/docs/getting-started/ENVIRONMENT.md @@ -123,6 +123,8 @@ node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" **Get API Key**: [Google AI Studio](https://aistudio.google.com/app/apikey) +**Test Environment Note**: The test/staging environment **deliberately omits** `GEMINI_API_KEY` to preserve free API quota. This is intentional - the API has strict daily limits on the free tier, and we want to reserve tokens for production use. AI features will be non-functional in test, but all other features can be tested normally. Deploy warnings about missing `GEMINI_API_KEY` in test logs are expected and safe to ignore. + ### Google Services | Variable | Required | Description | diff --git a/vite.config.ts b/vite.config.ts index bce85715..00050ba1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -39,6 +39,18 @@ const shouldUploadSourceMaps = process.env.VITE_SENTRY_DSN && process.env.SENTRY_AUTH_TOKEN; +/** + * Determines the Sentry project name based on environment. + * Test/staging deployments use 'flyer-crawler-frontend-test'. + * Production uses 'flyer-crawler-frontend'. + */ +const getSentryProject = () => { + const environment = process.env.VITE_SENTRY_ENVIRONMENT || process.env.NODE_ENV; + return environment === 'test' || environment === 'staging' + ? 'flyer-crawler-frontend-test' + : 'flyer-crawler-frontend'; +}; + /** * This is the main configuration file for Vite and the Vitest 'unit' test project. * When running `vitest`, it is orchestrated by `vitest.workspace.ts`, which @@ -61,9 +73,10 @@ export default defineConfig({ // URL of the Bugsink instance (Sentry-compatible) url: process.env.SENTRY_URL, - // Org and project are required by the API but Bugsink ignores them + // Org and project names for Bugsink + // Project name changes based on environment (test vs production) org: 'flyer-crawler', - project: 'flyer-crawler-frontend', + project: getSentryProject(), // Auth token from environment variable authToken: process.env.SENTRY_AUTH_TOKEN,