Skip to content

Commit

Permalink
Merge pull request #16 from muratkeremozcan/fe-api-url
Browse files Browse the repository at this point in the history
use PR backend api for front end
  • Loading branch information
muratkeremozcan committed Sep 18, 2023
2 parents 0d3da88 + 6242eeb commit c5bb36a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
- name: Build infrastructure and web
run: |
cd infrastructure
yarn build
yarn build:frontend
yarn build:branch
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/dev-stage-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@ jobs:
runTests: false
working-directory: web

- name: Build infrastructure and web
run: |
cd infrastructure
yarn build
yarn build:frontend
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume:
arn:aws:iam::${{ env.ACCOUNT_ID }}:role/GitHubActionsRole
role-session-name: GithubActionsSession

- name: Dynamically Set environment variables (dev, stage, prod)
run: |
if [ "${{ github.event_name }}" == "push" ] && [ ! -z "${{ github.event.ref }}" ]; then
Expand All @@ -76,6 +62,19 @@ jobs:
fi
fi
- name: Build infrastructure and web for ${{ env.NODE_ENV }}
run: |
cd infrastructure
yarn build:${{ env.NODE_ENV }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume:
arn:aws:iam::${{ env.ACCOUNT_ID }}:role/GitHubActionsRole
role-session-name: GithubActionsSession

- name: cdk synth
run: |
cd infrastructure && CDK_DEFAULT_ACCOUNT=${{ env.ACCOUNT_ID }} CDK_DEFAULT_REGION=${{ env.AWS_REGION }} NODE_ENV=${{ env.NODE_ENV }} DOTENV_CONFIG_PATH=${{ env.DOTENV_CONFIG_PATH }} npx cdk synth
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"build:frontend": "cd ../web && yarn build",
"prebuild": "rimraf dist",
"build": "tsc",
"build:branch": "yarn build && yarn build:frontend",
"build:dev": "cross-env NODE_ENV=dev yarn build && cross-env NODE_ENV=dev yarn build:frontend",
"build:stage": "cross-env NODE_ENV=stage yarn build && cross-env NODE_ENV=stage yarn build:frontend",
"build:prod": "cross-env NODE_ENV=prod yarn build && cross-env NODE_ENV=prod build:frontend",
"watch": "tsc -w",
"test": "yarn build && jest",
"lint": "eslint . --cache-location node_modules/.cache/eslint --fix",
Expand Down
2 changes: 1 addition & 1 deletion web/get-backend-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const {
} = require('../infrastructure/dist/infrastructure/lib/get-env-config.js')
const config = require('../config.json')

const {backend_subdomain} = getEnvironmentConfig(process.env.NODE_ENV || 'dev')
const {backend_subdomain} = getEnvironmentConfig(process.env.NODE_ENV)
const backendURL = `https://${backend_subdomain}.${config.domain_name}`

// Write to .env file
Expand Down

0 comments on commit c5bb36a

Please sign in to comment.