Skip to content

Commit 384b346

Browse files
committed
Revert "update infra and remove railway"
This reverts commit abfa2f8.
1 parent 5863266 commit 384b346

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 34 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' || github.ref == 'refs/heads/staging')
58+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
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-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/staging' }}
72+
type=raw,value=staging-${{ github.sha }}-${{ 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' || github.ref == 'refs/heads/staging') }}
81+
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
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' || github.ref == 'refs/heads/staging')
92+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
9393
strategy:
9494
matrix:
9595
include:
@@ -115,7 +115,6 @@ 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' }}
119118
type=sha,format=long
120119
121120
- name: Create and push manifest
@@ -149,32 +148,4 @@ jobs:
149148
docker manifest inspect "$arm64_image" || echo "ARM64 image not found"
150149
exit 1
151150
fi
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 }}"}}'
151+
done

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,25 @@ 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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://railway.app/railway.schema.json",
3+
"build": {
4+
"builder": "NIXPACKS",
5+
"buildCommand": "cd apps/sim && bun install --frozen-lockfile && bun run build"
6+
},
7+
"deploy": {
8+
"startCommand": "cd apps/sim && NODE_ENV=production bun run socket-server/index.ts",
9+
"healthcheckPath": "/health",
10+
"healthcheckTimeout": 300,
11+
"restartPolicyType": "ON_FAILURE",
12+
"restartPolicyMaxRetries": 10
13+
},
14+
"environments": {
15+
"production": {
16+
"variables": {
17+
"NODE_ENV": "production"
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)