chore: sync vercel env var with trigger.dev and deploy (#25610)
* chore: sync vercel env var with trigger.dev * chore: get trigger version from .env.production * chore: deploy trigger dev tasks in draft release * fixup! chore: deploy trigger dev tasks in draft release * fixup! Merge branch 'main' into sync-trigger-dev-env-vercel * remove trigger version from commit message it's already in .env.production * chore: use generated token instead of GITHUB_TOKEN in draft release * fix: code review
This commit is contained in:
@@ -55,6 +55,21 @@ jobs:
|
||||
|
||||
- uses: ./.github/actions/yarn-install
|
||||
|
||||
# 1. Generate Prisma Client
|
||||
# This is required so Trigger.dev can find the database types during bundling
|
||||
- name: Generate Prisma Client
|
||||
run: yarn prisma generate
|
||||
|
||||
# 2. Deploy Trigger.dev tasks
|
||||
# We use --skip-promotion to get a version without making it live yet
|
||||
- name: Deploy Trigger.dev
|
||||
id: deploy-trigger
|
||||
env:
|
||||
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
|
||||
run: |
|
||||
# The CLI outputs the version; id allows us to access outputs.deploymentVersion
|
||||
npx trigger.dev@latest deploy --skip-promotion
|
||||
|
||||
- name: Bump version
|
||||
env:
|
||||
VERSION: ${{ inputs.next_version }}
|
||||
@@ -62,6 +77,16 @@ jobs:
|
||||
cd apps/web
|
||||
yarn version "$VERSION"
|
||||
|
||||
# 3. Update .env.production files
|
||||
# We inject the Trigger version into the apps so they stay in sync
|
||||
- name: Update Env Files
|
||||
run: |
|
||||
VERSION="${{ steps.deploy-trigger.outputs.deploymentVersion }}"
|
||||
echo "TRIGGER_VERSION=$VERSION" > apps/web/.env.production
|
||||
echo "TRIGGER_VERSION=$VERSION" > apps/api/v2/.env.production
|
||||
git add -f apps/web/.env.production apps/api/v2/.env.production
|
||||
|
||||
# 4. Commit everything together
|
||||
- name: Commit changes
|
||||
env:
|
||||
VERSION: ${{ inputs.next_version }}
|
||||
@@ -73,5 +98,5 @@ jobs:
|
||||
- name: Draft release
|
||||
run: gh release create v$VERSION --generate-notes --draft
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
VERSION: ${{ inputs.next_version }}
|
||||
|
||||
@@ -27,7 +27,9 @@ import { AppController } from "./app.controller";
|
||||
imports: [
|
||||
SentryModule.forRoot(),
|
||||
ConfigModule.forRoot({
|
||||
ignoreEnvFile: true,
|
||||
...(process.env.NODE_ENV === "production"
|
||||
? { envFilePath: ".env.production" }
|
||||
: { ignoreEnvFile: true }),
|
||||
isGlobal: true,
|
||||
load: [appConfig],
|
||||
}),
|
||||
|
||||
+2
-1
@@ -42,7 +42,8 @@
|
||||
"dev:swagger": "turbo run dev --filter=\"@calcom/api-proxy\" --filter=\"@calcom/api\" --filter=\"@calcom/swagger\"",
|
||||
"dev:website": "turbo run dev --filter=\"@calcom/web\" --filter=\"@calcom/website\"",
|
||||
"dev:trigger": "turbo run dev:trigger --filter=\"@calcom/features\"",
|
||||
"deploy:trigger": "turbo run deploy:trigger --filter=\"@calcom/features\"",
|
||||
"deploy:trigger:prod": "turbo run deploy:trigger:prod --filter=\"@calcom/features\"",
|
||||
"deploy:trigger:staging": "turbo run deploy:trigger:staging --filter=\"@calcom/features\"",
|
||||
"dev": "turbo run dev --filter=\"@calcom/web\"",
|
||||
"dx": "turbo run dx",
|
||||
"i-dev": "infisical run -- turbo run dev --filter=\"@calcom/web\"",
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"scripts": {
|
||||
"lint": "biome lint .",
|
||||
"dev:trigger": "npx trigger.dev@latest dev --analyze",
|
||||
"deploy:trigger": "npx trigger.dev@latest deploy"
|
||||
"deploy:trigger:prod": "npx trigger.dev@latest deploy --skip-promotion",
|
||||
"deploy:trigger:staging": "npx trigger.dev@latest deploy --env staging --skip-promotion"
|
||||
},
|
||||
"dependencies": {
|
||||
"@calcom/atoms": "workspace:*",
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import { syncVercelEnvVars } from "@trigger.dev/build/extensions/core";
|
||||
import { defineConfig } from "@trigger.dev/sdk";
|
||||
import dotEnv from "dotenv";
|
||||
|
||||
dotEnv.config({ path: "../../.env" });
|
||||
|
||||
const canSyncEnvVars = Boolean(
|
||||
process.env.TRIGGER_DEV_VERCEL_ACCESS_TOKEN &&
|
||||
process.env.TRIGGER_DEV_VERCEL_PROJECT_ID &&
|
||||
process.env.TRIGGER_DEV_VERCEL_TEAM_ID
|
||||
);
|
||||
|
||||
export default defineConfig({
|
||||
// Your project ref from the Trigger.dev dashboard
|
||||
project: process.env.TRIGGER_DEV_PROJECT_REF ?? "", // e.g., "proj_abc123"
|
||||
@@ -22,9 +29,29 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
|
||||
// Keep the process alive after the task has finished running so the next task doesn’t have to wait for the process to start up again.
|
||||
processKeepAlive: true,
|
||||
|
||||
// Build configuration (optional)
|
||||
build: {
|
||||
external: ["@prisma/client", "nodemailer", "jsdom", "playwright-core", "playwright", "chromium-bidi"],
|
||||
extensions: canSyncEnvVars
|
||||
? [
|
||||
syncVercelEnvVars({
|
||||
// A personal access token created in your Vercel account settings
|
||||
// Used to authenticate API requests to Vercel
|
||||
// Generate at: https://vercel.com/account/tokens
|
||||
vercelAccessToken: process.env.TRIGGER_DEV_VERCEL_ACCESS_TOKEN,
|
||||
// The unique identifier of your Vercel project
|
||||
// Found in Project Settings > General > Project ID
|
||||
projectId: process.env.TRIGGER_DEV_VERCEL_PROJECT_ID,
|
||||
// Optional: The ID of your Vercel team
|
||||
// Only required for team projects
|
||||
// Found in Team Settings > General > Team ID
|
||||
vercelTeamId: process.env.TRIGGER_DEV_VERCEL_TEAM_ID,
|
||||
}),
|
||||
]
|
||||
: [],
|
||||
},
|
||||
|
||||
// Max duration of a task in seconds
|
||||
|
||||
+33
-6
@@ -286,6 +286,9 @@
|
||||
"TRIGGER_SECRET_KEY",
|
||||
"TRIGGER_API_URL",
|
||||
"TRIGGER_DEV_PROJECT_REF",
|
||||
"TRIGGER_DEV_VERCEL_ACCESS_TOKEN",
|
||||
"TRIGGER_DEV_VERCEL_PROJECT_ID",
|
||||
"TRIGGER_DEV_VERCEL_TEAM_ID",
|
||||
"ENABLE_ASYNC_TASKER",
|
||||
"STRIPE_ORG_PRODUCT_ID",
|
||||
"GOOGLE_ADS_ENABLED",
|
||||
@@ -393,8 +396,10 @@
|
||||
"NEXT_PUBLIC_SENTRY_DSN_CLIENT",
|
||||
"BUILD_STANDALONE",
|
||||
"NEXT_PUBLIC_API_HITPAY_PRODUCTION",
|
||||
"NEXT_PUBLIC_API_HITPAY_SANDBOX"
|
||||
]
|
||||
"NEXT_PUBLIC_API_HITPAY_SANDBOX",
|
||||
"TRIGGER_VERSION"
|
||||
],
|
||||
"inputs": ["$TURBO_DEFAULT$", ".env.production"]
|
||||
},
|
||||
"@calcom/web#dx": {
|
||||
"cache": false,
|
||||
@@ -418,8 +423,11 @@
|
||||
"LOG_LEVEL",
|
||||
"NEXTAUTH_SECRET",
|
||||
"USE_POOL",
|
||||
"LOGGER_BRIDGE_LOG_LEVEL"
|
||||
]
|
||||
"LOGGER_BRIDGE_LOG_LEVEL",
|
||||
"REDIS_URL",
|
||||
"TRIGGER_VERSION"
|
||||
],
|
||||
"inputs": ["$TURBO_DEFAULT$", ".env.production"]
|
||||
},
|
||||
"@calcom/ai#build": {
|
||||
"env": [
|
||||
@@ -499,9 +507,28 @@
|
||||
"env": ["TRIGGER_DEV_PROJECT_REF"],
|
||||
"cache": false
|
||||
},
|
||||
"deploy:trigger": {
|
||||
"deploy:trigger:prod": {
|
||||
"inputs": ["./.env"],
|
||||
"env": ["TRIGGER_DEV_PROJECT_REF"],
|
||||
"env": [
|
||||
"TRIGGER_DEV_PROJECT_REF",
|
||||
"TRIGGER_API_URL",
|
||||
"TRIGGER_SECRET_KEY",
|
||||
"TRIGGER_DEV_VERCEL_ACCESS_TOKEN",
|
||||
"TRIGGER_DEV_VERCEL_PROJECT_ID",
|
||||
"TRIGGER_DEV_VERCEL_TEAM_ID"
|
||||
],
|
||||
"cache": false
|
||||
},
|
||||
"deploy:trigger:staging": {
|
||||
"inputs": ["./.env"],
|
||||
"env": [
|
||||
"TRIGGER_DEV_PROJECT_REF",
|
||||
"TRIGGER_API_URL",
|
||||
"TRIGGER_SECRET_KEY",
|
||||
"TRIGGER_DEV_VERCEL_ACCESS_TOKEN",
|
||||
"TRIGGER_DEV_VERCEL_PROJECT_ID",
|
||||
"TRIGGER_DEV_VERCEL_TEAM_ID"
|
||||
],
|
||||
"cache": false
|
||||
},
|
||||
"dx": {
|
||||
|
||||
Reference in New Issue
Block a user