Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsh-Srivastav123 authored May 13, 2024
1 parent 10d0910 commit 3bf438a
Showing 1 changed file with 71 additions and 33 deletions.
104 changes: 71 additions & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,78 @@
# - name: Build
# run: npm run build

name: Quizmate-Frontend
# name: Quizmate-Frontend

# on:
# push:
# branches: [main]

# defaults:
# run:
# working-directory: ./client

# jobs:
# build:
# runs-on: ubuntu-latest

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

# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '16'
# cache: 'npm'

# - name: Install dependencies
# run: npm install

# - name: Build
# run: npm run build

# # - name: Archive dist folder
# # uses: actions/upload-artifact@v2
# # with:
# # name: dist
# # path: dist

# # - name: Copy dist folder to client directory
# # run: cp -r dist/ ../client/

# - name: Commit and push changes
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "Harsh-Srivastav123"
# git add .
# git commit -m "Update dist folder"
# git push origin main

# Deploy:
# runs-on: ['self-hosted', 'Linux', 'X64', 'gcp']
# steps:
# - name: Checkout code and dist folder
# uses: actions/checkout@v2

# - name: Restart Nginx
# run: sudo systemctl restart nginx


name: CI/CD

on:
push:
branches: [main]

defaults:
run:
working-directory: ./client
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

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



- name: Set up Node.js
uses: actions/setup-node@v2
Expand All @@ -55,32 +110,15 @@ jobs:

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

# - name: Archive dist folder
# uses: actions/upload-artifact@v2
# with:
# name: dist
# path: dist

# - name: Copy dist folder to client directory
# run: cp -r dist/ ../client/

- name: Commit and push changes
- name: Deploy to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ap-south-1
S3_BUCKET_NAME: qrcode-data
run: |
git config --global user.email "[email protected]"
git config --global user.name "Harsh-Srivastav123"
git add .
git commit -m "Update dist folder"
git push origin main
Deploy:
runs-on: ['self-hosted', 'Linux', 'X64', 'gcp']
steps:
- name: Checkout code and dist folder
uses: actions/checkout@v2

- name: Restart Nginx
run: sudo systemctl restart nginx
aws s3 sync build/ s3://$S3_BUCKET_NAME --delete

0 comments on commit 3bf438a

Please sign in to comment.