Skip to content

Commit 2f9c295

Browse files
committed
update infra and remove railway
1 parent f018659 commit 2f9c295

3 files changed

Lines changed: 34 additions & 48 deletions

File tree

.github/workflows/build.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
uses: docker/setup-buildx-action@v3
5656

5757
- name: Log in to the Container registry
58-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
58+
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
5959
uses: docker/login-action@v3
6060
with:
6161
registry: ghcr.io
@@ -69,7 +69,7 @@ jobs:
6969
images: ${{ matrix.image }}
7070
tags: |
7171
type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }}
72-
type=raw,value=staging-${{ github.sha }}-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
72+
type=raw,value=staging-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
7373
type=sha,format=long,suffix=-${{ matrix.arch }}
7474
7575
- name: Build and push Docker image
@@ -78,7 +78,7 @@ jobs:
7878
context: .
7979
file: ${{ matrix.dockerfile }}
8080
platforms: ${{ matrix.platform }}
81-
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
81+
push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }}
8282
tags: ${{ steps.meta.outputs.tags }}
8383
labels: ${{ steps.meta.outputs.labels }}
8484
cache-from: type=gha,scope=build-v3
@@ -89,7 +89,7 @@ jobs:
8989
create-manifests:
9090
runs-on: ubuntu-latest
9191
needs: build-and-push
92-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
92+
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
9393
strategy:
9494
matrix:
9595
include:
@@ -115,6 +115,7 @@ jobs:
115115
images: ${{ matrix.image }}
116116
tags: |
117117
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
118+
type=raw,value=staging,enable=${{ github.ref == 'refs/heads/staging' }}
118119
type=sha,format=long
119120
120121
- name: Create and push manifest
@@ -148,4 +149,32 @@ jobs:
148149
docker manifest inspect "$arm64_image" || echo "ARM64 image not found"
149150
exit 1
150151
fi
151-
done
152+
done
153+
154+
trigger-infrastructure-deploy:
155+
runs-on: ubuntu-latest
156+
needs: create-manifests
157+
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
158+
permissions:
159+
contents: read
160+
161+
steps:
162+
- name: Trigger staging deployment
163+
if: github.ref == 'refs/heads/staging'
164+
run: |
165+
curl -X POST \
166+
-H "Accept: application/vnd.github.v3+json" \
167+
-H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \
168+
-H "X-GitHub-Api-Version: 2022-11-28" \
169+
https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \
170+
-d '{"event_type":"staging-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}'
171+
172+
- name: Trigger production deployment
173+
if: github.ref == 'refs/heads/main'
174+
run: |
175+
curl -X POST \
176+
-H "Accept: application/vnd.github.v3+json" \
177+
-H "Authorization: token ${{ secrets.INFRA_DEPLOY_TOKEN }}" \
178+
-H "X-GitHub-Api-Version: 2022-11-28" \
179+
https://api.github.com/repos/${{ secrets.INFRA_REPO }}/dispatches \
180+
-d '{"event_type":"production-deploy","client_payload":{"sha":"${{ github.sha }}","ref":"${{ github.ref }}"}}'

.github/workflows/ci.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,3 @@ jobs:
5353
fail_ci_if_error: false
5454
verbose: true
5555

56-
migrations:
57-
name: Apply Database Migrations
58-
runs-on: ubuntu-latest
59-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
60-
needs: test
61-
steps:
62-
- name: Checkout code
63-
uses: actions/checkout@v4
64-
65-
- name: Setup Bun
66-
uses: oven-sh/setup-bun@v2
67-
with:
68-
bun-version: latest
69-
70-
- name: Install dependencies
71-
run: bun install
72-
73-
- name: Apply migrations
74-
working-directory: ./apps/sim
75-
env:
76-
DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }}
77-
run: bunx drizzle-kit migrate

railway.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)