Skip to content

Commit

Permalink
Merge pull request #9 from get-amigo/gh-action-test
Browse files Browse the repository at this point in the history
Gh action scripts
  • Loading branch information
tirthajyoti-ghosh authored May 9, 2024
2 parents 556d230 + bdcd061 commit e1b23cc
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/deploy-to-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy to Vercel

on:
push:
branches:
- develop

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set Vercel Environment Variables
run: |
echo "VERCEL_ORG_ID=${{ secrets.VERCEL_ORG_ID }}" >> $GITHUB_ENV
echo "VERCEL_PROJECT_ID=${{ secrets.VERCEL_DEV_PROJECT_ID }}" >> $GITHUB_ENV
- name: Install dependencies
run: npm install

- name: Create .env file
run: |
echo "JWT_SECRET=${{ secrets.DEV_JWT_SECRET }}" >> .env
echo "DATABASE_URL=${{ secrets.DEV_DATABASE_URL }}" >> .env
echo "ACCESS_CODE_EXPIRY=1y" >> .env
echo "ENV=development" >> .env
- name: Build project
run: npm run build

- name: Install Vercel CLI
run: npm i -g vercel@latest

- name: Deploy to Vercel
run: vercel --token ${{ secrets.VERCEL_TOKEN }} --prod
38 changes: 38 additions & 0 deletions .github/workflows/deploy-to-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy to Vercel

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set Vercel Environment Variables
run: |
echo "VERCEL_ORG_ID=${{ secrets.VERCEL_ORG_ID }}" >> $GITHUB_ENV
echo "VERCEL_PROJECT_ID=${{ secrets.VERCEL_PRODUCTION_PROJECT_ID }}" >> $GITHUB_ENV
- name: Install dependencies
run: npm install

- name: Create .env file
run: |
echo "JWT_SECRET=${{ secrets.PRODUCTION_JWT_SECRET }}" >> .env
echo "DATABASE_URL=${{ secrets.PRODUCTION_DATABASE_URL }}" >> .env
echo "ACCESS_CODE_EXPIRY=1y" >> .env
echo "ENV=production" >> .env
- name: Build project
run: npm run build

- name: Install Vercel CLI
run: npm i -g vercel@latest

- name: Deploy to Vercel
run: vercel --token ${{ secrets.VERCEL_TOKEN }} --prod
38 changes: 38 additions & 0 deletions .github/workflows/deploy-to-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy to Vercel

on:
push:
branches:
- staging

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set Vercel Environment Variables
run: |
echo "VERCEL_ORG_ID=${{ secrets.VERCEL_ORG_ID }}" >> $GITHUB_ENV
echo "VERCEL_PROJECT_ID=${{ secrets.VERCEL_STAGING_PROJECT_ID }}" >> $GITHUB_ENV
- name: Install dependencies
run: npm install

- name: Create .env file
run: |
echo "JWT_SECRET=${{ secrets.STAGING_JWT_SECRET }}" >> .env
echo "DATABASE_URL=${{ secrets.STAGING_DATABASE_URL }}" >> .env
echo "ACCESS_CODE_EXPIRY=1y" >> .env
echo "ENV=staging" >> .env
- name: Build project
run: npm run build

- name: Install Vercel CLI
run: npm i -g vercel@latest

- name: Deploy to Vercel
run: vercel --token ${{ secrets.VERCEL_TOKEN }} --prod
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ lerna-debug.log*
yarn.lock
package.lock.json
.vercel

.vercel
2 changes: 1 addition & 1 deletion src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getHello(): string {
return 'Server is running';
return 'Server is running!';
}
}

0 comments on commit e1b23cc

Please sign in to comment.