Skip to content

Commit

Permalink
chore: frontend manual deploy (#62)
Browse files Browse the repository at this point in the history
* chore: frontend manual deploy

* chore: only build web app package

* chore: deploy frontend in production
  • Loading branch information
tericcabrel committed Mar 24, 2024
1 parent 811625e commit 61ddebe
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 12 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name: Build Project
name: Build and preview the project
on:
pull_request:
branches: [ main ]

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: build
runs-on: ubuntu-latest
env:
NODE_ENV: test
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_PORT: 3306
Expand Down Expand Up @@ -56,3 +59,22 @@ jobs:

- name: Run tests
run: yarn test

preview-frontend:
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Install Yarn 4
run: |
corepack enable
yarn set version berry
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Core Backend
name: Deploy the backend
on:
push:
branches:
Expand All @@ -18,10 +18,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Copy the core Dockerfile in the root repository
run: cp apps/core/Dockerfile .

- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: public.ecr.aws/x9y5g9l2
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/deploy-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy the frontend
on:
push:
branches:
- main
paths:
- 'apps/web/src/**'
- 'apps/web/public/**'

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

jobs:
deploy:
runs-on: ubuntu-latest
environment: 'Production'
steps:
- uses: actions/checkout@v4
- name: Install Yarn 4
run: |
corepack enable
yarn set version berry
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ key.txt
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.vercel
2 changes: 1 addition & 1 deletion apps/web/src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const COOKIE_NAME = 'shguid';
export const COOKIE_NAME = 'snpc_guid';
export const REGEX_EMAIL = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
export const IS_DEV = process.env.NEXT_PUBLIC_APP_ENV === 'development';
export const IS_PROD = process.env.NEXT_PUBLIC_APP_ENV === 'production';
Expand Down
9 changes: 5 additions & 4 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"github": {
"enabled": true,
"silent": true
}
"git": {
"deploymentEnabled": false
},
"buildCommand": "yarn build --filter=...@snipcode/web",
"outputDirectory": "apps/web/.next"
}

0 comments on commit 61ddebe

Please sign in to comment.