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 4 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
40 changes: 40 additions & 0 deletions .github/workflows/nodejs-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Cache Node.js Application
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

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

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

- name: Install pnpm
run: cd frontend && npm install -g pnpm
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

- 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
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

- name: Build the application
run: cd frontend && pnpm run build
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

- name: Deploy the application
run: cd frontend && pnpm run deploy
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved
38 changes: 38 additions & 0 deletions .github/workflows/nodejs-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Cache Node.js Application
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

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

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

- name: Install pnpm
run: cd frontend && npm install -g pnpm
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

- 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
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

- name: Build the application
run: cd frontend && pnpm run build
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved

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