Skip to content

Commit

Permalink
add github workflow to build and deploy frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
arv-anshul committed Dec 26, 2024
1 parent 6f9fdb8 commit 44b9f7e
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build_frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Deploy Frontend

on:
push:
paths:
- .github/workflows/build_frontend.yaml
- frontend/**

jobs:
build-and-deploy-frontend:
runs-on: ubuntu-latest

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

# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

# Install dependencies
- name: Install dependencies
working-directory: ./frontend
run: npm install

# Set environment variables for the build
- name: Set environment variables
run: |
echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" >> ./frontend/.env.production
echo "VITE_YOUTUBE_API_URL=${{ secrets.VITE_YOUTUBE_API_URL }}" >> ./frontend/.env.production
# Build the app
- name: Build the app
working-directory: ./frontend
run: npm run build

# Deploy to GitHub Pages branch
- name: Deploy to GitHub Pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./frontend/dist

0 comments on commit 44b9f7e

Please sign in to comment.