From 8c62376c79f64c20032f7822b304c15013978236 Mon Sep 17 00:00:00 2001 From: waleedlatif1 Date: Sat, 6 Sep 2025 13:27:40 -0700 Subject: [PATCH 1/3] update infra and remove railway --- .github/workflows/build.yml | 39 ++++++++++++++++++++++++++++++++----- .github/workflows/ci.yml | 22 --------------------- railway.json | 21 -------------------- 3 files changed, 34 insertions(+), 48 deletions(-) delete mode 100644 railway.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30d2eb2608..518add6b14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') uses: docker/login-action@v3 with: registry: ghcr.io @@ -69,7 +69,7 @@ jobs: images: ${{ matrix.image }} tags: | type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }} - type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }} + type=raw,value=staging-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }} type=sha,format=long,suffix=-${{ matrix.arch }} - name: Build and push Docker image @@ -78,7 +78,7 @@ jobs: context: . file: ${{ matrix.dockerfile }} platforms: ${{ matrix.platform }} - push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} + push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha,scope=build-v3 @@ -89,7 +89,7 @@ jobs: create-manifests: runs-on: ubuntu-latest needs: build-and-push - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') strategy: matrix: include: @@ -115,6 +115,7 @@ jobs: images: ${{ matrix.image }} tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value=staging,enable=${{ github.ref == 'refs/heads/staging' }} type=sha,format=long - name: Create and push manifest @@ -148,4 +149,32 @@ jobs: docker manifest inspect "$arm64_image" || echo "ARM64 image not found" exit 1 fi - done \ No newline at end of file + done + + trigger-infrastructure-deploy: + runs-on: ubuntu-latest + needs: create-manifests + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' + permissions: + contents: read + + steps: + - name: Trigger staging deployment + if: github.ref == 'refs/heads/staging' + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \ + -d '{"event_type":"staging-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}' + + - name: Trigger production deployment + if: github.ref == 'refs/heads/main' + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \ + -d '{"event_type":"production-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}' \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffd68d8b87..0f64e4f960 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,25 +53,3 @@ jobs: fail_ci_if_error: false verbose: true - migrations: - name: Apply Database Migrations - runs-on: ubuntu-latest - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') - needs: test - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Bun - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - - name: Install dependencies - run: bun install - - - name: Apply migrations - working-directory: ./apps/sim - env: - DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }} - run: bunx drizzle-kit migrate diff --git a/railway.json b/railway.json deleted file mode 100644 index 62d6da767e..0000000000 --- a/railway.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "https://railway.app/railway.schema.json", - "build": { - "builder": "NIXPACKS", - "buildCommand": "cd apps/sim && bun install --frozen-lockfile && bun run build" - }, - "deploy": { - "startCommand": "cd apps/sim && NODE_ENV=production bun run socket-server/index.ts", - "healthcheckPath": "/health", - "healthcheckTimeout": 300, - "restartPolicyType": "ON_FAILURE", - "restartPolicyMaxRetries": 10 - }, - "environments": { - "production": { - "variables": { - "NODE_ENV": "production" - } - } - } -} From 8cc4fe87640451ea4cfd537fedb1a6a8f9b3f521 Mon Sep 17 00:00:00 2001 From: waleedlatif1 Date: Mon, 15 Sep 2025 17:46:31 -0700 Subject: [PATCH 2/3] fix(build): fixed the build --- apps/docs/package.json | 2 +- bun.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/docs/package.json b/apps/docs/package.json index 904cb1aea5..8394c17387 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -15,7 +15,7 @@ "@vercel/analytics": "1.5.0", "@vercel/og": "^0.6.5", "clsx": "^2.1.1", - "fumadocs-core": "^15.0.16", + "fumadocs-core": "^15.7.5", "fumadocs-mdx": "^11.5.6", "fumadocs-ui": "^15.0.16", "lucide-react": "^0.511.0", diff --git a/bun.lock b/bun.lock index c15132c952..13cbc26b19 100644 --- a/bun.lock +++ b/bun.lock @@ -31,7 +31,7 @@ "@vercel/analytics": "1.5.0", "@vercel/og": "^0.6.5", "clsx": "^2.1.1", - "fumadocs-core": "^15.0.16", + "fumadocs-core": "^15.7.5", "fumadocs-mdx": "^11.5.6", "fumadocs-ui": "^15.0.16", "lucide-react": "^0.511.0", From 529280375309af09cfd0fcb78bae8c2b345bdd43 Mon Sep 17 00:00:00 2001 From: waleedlatif1 Date: Mon, 15 Sep 2025 17:47:06 -0700 Subject: [PATCH 3/3] Revert "update infra and remove railway" This reverts commit abfa2f8d51901247acc6397960210569e84d72b1. --- .github/workflows/build.yml | 39 +++++-------------------------------- .github/workflows/ci.yml | 22 +++++++++++++++++++++ railway.json | 21 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 railway.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 518add6b14..30d2eb2608 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' uses: docker/login-action@v3 with: registry: ghcr.io @@ -69,7 +69,7 @@ jobs: images: ${{ matrix.image }} tags: | type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }} - type=raw,value=staging-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }} + type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }} type=sha,format=long,suffix=-${{ matrix.arch }} - name: Build and push Docker image @@ -78,7 +78,7 @@ jobs: context: . file: ${{ matrix.dockerfile }} platforms: ${{ matrix.platform }} - push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} + push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha,scope=build-v3 @@ -89,7 +89,7 @@ jobs: create-manifests: runs-on: ubuntu-latest needs: build-and-push - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' strategy: matrix: include: @@ -115,7 +115,6 @@ jobs: images: ${{ matrix.image }} tags: | type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} - type=raw,value=staging,enable=${{ github.ref == 'refs/heads/staging' }} type=sha,format=long - name: Create and push manifest @@ -149,32 +148,4 @@ jobs: docker manifest inspect "$arm64_image" || echo "ARM64 image not found" exit 1 fi - done - - trigger-infrastructure-deploy: - runs-on: ubuntu-latest - needs: create-manifests - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' - permissions: - contents: read - - steps: - - name: Trigger staging deployment - if: github.ref == 'refs/heads/staging' - run: | - curl -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \ - -d '{"event_type":"staging-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}' - - - name: Trigger production deployment - if: github.ref == 'refs/heads/main' - run: | - curl -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \ - -d '{"event_type":"production-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}' \ No newline at end of file + done \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f64e4f960..ffd68d8b87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,25 @@ jobs: fail_ci_if_error: false verbose: true + migrations: + name: Apply Database Migrations + runs-on: ubuntu-latest + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') + needs: test + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Apply migrations + working-directory: ./apps/sim + env: + DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }} + run: bunx drizzle-kit migrate diff --git a/railway.json b/railway.json new file mode 100644 index 0000000000..62d6da767e --- /dev/null +++ b/railway.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://railway.app/railway.schema.json", + "build": { + "builder": "NIXPACKS", + "buildCommand": "cd apps/sim && bun install --frozen-lockfile && bun run build" + }, + "deploy": { + "startCommand": "cd apps/sim && NODE_ENV=production bun run socket-server/index.ts", + "healthcheckPath": "/health", + "healthcheckTimeout": 300, + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + }, + "environments": { + "production": { + "variables": { + "NODE_ENV": "production" + } + } + } +}