Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Automatic deployment of frontend #67

Merged
merged 15 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/build-ci-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Integration Test (Build)

on:
pull_request:
types:
- opened
- synchronize
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.2.0

- name: Install pnpm
run: |
cd frontend
npm install -g pnpm

- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
if: steps.pnpm-cache.outputs.cache-hit != 'true'
run: |
cd frontend
pnpm install

- name: Build the application
run: |
cd frontend
pnpm run build

- name: Save build artifacts
if: success()
uses: actions/upload-artifact@v4
with:
name: build
path: ./frontend/build/

25 changes: 25 additions & 0 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy to Github Pages

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

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

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: build
path: ./frontend/build/

- name: Push to deployment
run: |
cd frontend
pnpm run deploy
6 changes: 3 additions & 3 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, useEffect, useState } from "react";
import React, { useEffect, useState } from "react";
import "./App.css";
import CustomTable from "./CustomTable.js";
import PropTypes from "prop-types";
Expand All @@ -23,14 +23,14 @@ function App({ schedule, empty_schedule }) {
if (loading)
return (
<div className="message-banner">
<iframe src="https://lottie.host/?file=ca9a3787-e6db-4878-a0d3-d10dde95b225/MjnHw4B5gw.json"></iframe>
<iframe src="https://lottie.host/?file=ca9a3787-e6db-4878-a0d3-d10dde95b225/MjnHw4B5gw.json" title="cat-1"></iframe>
<div className="message">Chillzone is loading</div>
</div>
);
else if (!show)
return (
<div className="message-banner">
<iframe src="https://lottie.host/?file=46b58d32-043e-4268-94cd-4d7817565000/xNnhIYFoYA.json"></iframe>
<iframe src="https://lottie.host/?file=46b58d32-043e-4268-94cd-4d7817565000/xNnhIYFoYA.json" title="cat-2"></iframe>
<div className="message">
Please connect to IIT Kharagpur campus network to access this site!
</div>
Expand Down
Loading