diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff9cb1e..f4adfa6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: - branches: [main, heroku] + branches: [main, production] # Runs on any open or reopened pull request pull_request: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..ac24e9f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: Production Deployment [NextJS] + +on: + pull_request: + branches: [production] + types : [closed] + + push: + branches: [production] + + workflow_dispatch: + +jobs: + deploy: + if: (github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch') + runs-on: ubuntu-latest + steps: + - name: Deploy using ssh + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.PRODUCTION_HOST }} + username: ${{ secrets.PRODUCTION_USERNAME }} + key: ${{ secrets.PRODUCTION_PRIVATE_KEY }} + port: 22 + script: | + cd ${{ vars.REPOSITORY_DIRECTORY }} + echo "Fetching latest version from the production branch" + git fetch --all + git reset --hard origin/production + git status + echo "Installing updates" + export NVM_DIR=~/.nvm + source ~/.nvm/nvm.sh + npm ci + echo "Building project" + npm build + echo "Restarting PM2 Process ${{ vars.PM2_PROCESS }}" + PM2_HOME=/root/.pm2 pm2 restart ${{ vars.PM2_PROCESS }} + run: | + echo Pull request merged and deployed to Production diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2a52318..c9b37a8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,7 @@ name: ESLint on: pull_request: - branches: [main, heroku] + branches: [main, production] push: branches: [main] workflow_dispatch: diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml deleted file mode 100644 index 1f5d573..0000000 --- a/.github/workflows/update.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Update Request - -on: - pull_request: - types: [closed] - branches: [heroku] - workflow_dispatch: - branches: [heroku] - - -jobs: - update: - if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - steps: - - name: Send HTTP request - id: request - uses: tyrrrz/action-http-request@master - with: - url: ${{vars.FRONTEND_UPDATE_ENDPOINT}} - method: POST - headers: | - Content-Type: application/json - body: | - { - "FRONTEND_UPDATE_REQUEST_TOKEN": "${{secrets.FRONTEND_UPDATE_REQUEST_TOKEN}}" - } - - - name: Print outputs - run: | - echo "Status: ${{ steps.request.outputs.status }}" - echo "Success: ${{ steps.request.outputs.success }}" \ No newline at end of file diff --git a/README.md b/README.md index 7f2da3c..2791721 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # BNCHS Sentinels Website v5.0 -![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white) ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) ![Redux](https://img.shields.io/badge/redux-%23593d88.svg?style=for-the-badge&logo=redux&logoColor=white) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white) ![Heroku](https://img.shields.io/badge/heroku-%23430098.svg?style=for-the-badge&logo=heroku&logoColor=white) +![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white) ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) ![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white) [![Build](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/build.yml/badge.svg)](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/build.yml) [![ESLint](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/lint.yml/badge.svg)](https://github.com/Team5599/BNCHS-Sentinels-Website-v5/actions/workflows/lint.yml) @@ -53,19 +53,9 @@ To learn more about Next.js, take a look at the following resources: - [Next.js Documentation](https://nextjs.org/docs) - Learn about Next.js features and API. - [Learn Next.js](https://nextjs.org/learn) - An interactive Next.js tutorial. -To learn more about Redux, take a look at the following resources: -- [Redux Fundamentals](https://redux.js.org/tutorials/fundamentals/part-1-overview) - Learn the core concepts, principles, and patterns of Redux -- [Redux Tutorials](https://redux.js.org/tutorials/index) - More resources for learning Redux +## Deploying to Production -## Deploying to Heroku - -The ``heroku`` branch is responsible for deploying to our live production server Heroku. - -You cannot push directly to the ``heroku`` branch. You must create a pull request to merge your branch into the ``heroku`` branch. When you create a pull request, an ESLint check is run against your changes. - -The ESLint check is responsible for catching breaking bugs and unoptimizations before being deployed to Heroku. - -Once the ESLint check is successful, the pull request can be merged. When merging is complete, GitHub Actions runs our "Heroku Deploy action", uploading the changes to our Heroku host. +The ``production`` branch is responsible for deploying to our VPS. To make changes to the website, create a pull request to merge your changes into the ``production`` branch. ## API diff --git a/app/Calendar/page.js b/app/Calendar/page.js index 7c0bf0f..a55ffdb 100644 --- a/app/Calendar/page.js +++ b/app/Calendar/page.js @@ -25,7 +25,7 @@ const CALENDAR_DATA = [ requiresAuthentication : false }, { - label : 'Programming Calendar', + label : 'Programming Calendar', calendarID : 'classroom108355962532255578415@group.calendar.google.com', color : '#ffff00', enabledByDefault : true, diff --git a/docs/Other Documentation.md b/docs/Other Documentation.md index e1a8402..54cd9d3 100644 --- a/docs/Other Documentation.md +++ b/docs/Other Documentation.md @@ -23,7 +23,7 @@ Until we have a proper storage solution, backups are currently scattered and har ## Cloudflare -While the project is hosted on Heroku, Cloudflare is responsible for handlign a variety of services: +While the project is hosted on Hetzner, Cloudflare is responsible for handling a variety of services: - Caching - Auto minificiation - DNS Management @@ -31,7 +31,7 @@ While the project is hosted on Heroku, Cloudflare is responsible for handlign a - Analytics - DDOS Protection -Our SSL certificates are handled by Heroku. +Our SSL certificates are handled by Cloudflare. > ℹ️ Did you know we average about 1.29k requests through Cloudflare a day?