Skip to content

Commit 4aacc8e

Browse files
committed
feat(infra): add dev environment support
1 parent 7d0fdef commit 4aacc8e

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, staging]
5+
branches: [main, staging, dev]
66
pull_request:
7-
branches: [main, staging]
7+
branches: [main, staging, dev]
88

99
concurrency:
1010
group: ci-${{ github.ref }}
@@ -23,7 +23,7 @@ jobs:
2323
detect-version:
2424
name: Detect Version
2525
runs-on: blacksmith-4vcpu-ubuntu-2404
26-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
26+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/dev')
2727
outputs:
2828
version: ${{ steps.extract.outputs.version }}
2929
is_release: ${{ steps.extract.outputs.is_release }}
@@ -49,7 +49,7 @@ jobs:
4949
build-amd64:
5050
name: Build AMD64
5151
needs: [test-build, detect-version]
52-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
52+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/dev')
5353
runs-on: blacksmith-8vcpu-ubuntu-2404
5454
permissions:
5555
contents: read
@@ -75,8 +75,8 @@ jobs:
7575
- name: Configure AWS credentials
7676
uses: aws-actions/configure-aws-credentials@v4
7777
with:
78-
role-to-assume: ${{ github.ref == 'refs/heads/main' && secrets.AWS_ROLE_TO_ASSUME || secrets.STAGING_AWS_ROLE_TO_ASSUME }}
79-
aws-region: ${{ github.ref == 'refs/heads/main' && secrets.AWS_REGION || secrets.STAGING_AWS_REGION }}
78+
role-to-assume: ${{ github.ref == 'refs/heads/main' && secrets.AWS_ROLE_TO_ASSUME || github.ref == 'refs/heads/dev' && secrets.DEV_AWS_ROLE_TO_ASSUME || secrets.STAGING_AWS_ROLE_TO_ASSUME }}
79+
aws-region: ${{ github.ref == 'refs/heads/main' && secrets.AWS_REGION || github.ref == 'refs/heads/dev' && secrets.DEV_AWS_REGION || secrets.STAGING_AWS_REGION }}
8080

8181
- name: Login to Amazon ECR
8282
id: login-ecr

.github/workflows/images.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
# ECR tags (always build for ECR)
7171
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
7272
ECR_TAG="latest"
73+
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
74+
ECR_TAG="dev"
7375
else
7476
ECR_TAG="staging"
7577
fi

apps/sim/lib/core/config/feature-flags.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ export const isDev = env.NODE_ENV === 'development'
1919
export const isTest = env.NODE_ENV === 'test'
2020

2121
/**
22-
* Is this the hosted version of the application
23-
*/
24-
export const isHosted =
25-
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
26-
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
22+
* Is this the hosted version of the application.
23+
* True for sim.ai and any subdomain of sim.ai (e.g. staging.sim.ai, dev.sim.ai).
24+
*/
25+
export const isHosted = (() => {
26+
try {
27+
const hostname = new URL(getEnv('NEXT_PUBLIC_APP_URL') || '').hostname
28+
return hostname === 'sim.ai' || hostname.endsWith('.sim.ai')
29+
} catch {
30+
return false
31+
}
32+
})()
2733

2834
/**
2935
* Is billing enforcement enabled

0 commit comments

Comments
 (0)