Skip to content

Commit

Permalink
Merge branch 'dev' into switchOrganization
Browse files Browse the repository at this point in the history
  • Loading branch information
incredible-phoenix246 authored Aug 15, 2024
2 parents faed2f8 + 97eb2cf commit 995c400
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 35 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/anchor-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Anchor Deployment

on:
workflow_run:
workflows: ["Build and Upload"]
types:
- completed

jobs:
deploy_to_java:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

environment:
name: "anchor-java"
url: ${{ vars.URL }}

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: boilerplate-build
path: .

- name: Decode and create .env file
run: |
echo ${{ secrets.ENV }} | base64 -d > .env.java
- name: Copy Artifacts to server
run: |
sudo apt update && sudo apt install sshpass -y
sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.java ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/java
rm -f boilerplate.tar.gz .env.java
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd boilerplate-frontend
rm -rf *
tar -xzf /tmp/java/boilerplate.tar.gz
mv /tmp/java/.env.java .env
rm -f /tmp/java/boilerplate.tar.gz
cp -r .next/standalone/* .
pm2 restart java-boilerplate --update-env
deploy_to_python:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

environment:
name: "anchor-python"
url: ${{ vars.URL }}

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: boilerplate-build
path: .

- name: Decode and create .env file
run: |
echo ${{ secrets.ENV }} | base64 -d > .env.python
- name: Copy Artifacts to server
run: |
sudo apt update && sudo apt install sshpass -y
sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.python ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/python
rm -f boilerplate.tar.gz .env.python
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd boilerplate-frontend
rm -rf *
tar -xzf /tmp/python/boilerplate.tar.gz
mv /tmp/python/.env.python .env
rm -f /tmp/python/boilerplate.tar.gz
cp -r .next/standalone/* .
pm2 restart python-boilerplate --update-env
71 changes: 37 additions & 34 deletions .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,41 @@ jobs:
runs-on: ubuntu-latest
if: github.event.repository.fork == false

environment:
name: "dev"
url: ${{ vars.URL }}

steps:
- uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t hngdevops/nextjs-boilerplate:dev -f docker/development/Dockerfile .

- name: Save and compress Docker image
run: |
docker save hngdevops/nextjs-boilerplate:dev > nextjs-dev.tar
gzip nextjs-dev.tar
- name: Copy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "nextjs-dev.tar.gz"
target: "/tmp/nextjs"

- name: Load image in server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /tmp/nextjs
gunzip nextjs-dev.tar.gz
docker load < nextjs-dev.tar
rm -f nextjs-dev.tar
- uses: actions/checkout@v4

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

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

- name: Install dependencies
run: pnpm install

- name: Build Next.js application
run: pnpm build

- name: Archive production artifacts
run: tar -czf boilerplate.tar.gz .next public

- name: Upload production artifacts
uses: actions/upload-artifact@v3
with:
name: boilerplate-build
path: boilerplate.tar.gz

- name: Delete zip file
run: rm -f boilerplate.tar.gz
50 changes: 50 additions & 0 deletions .github/workflows/starlight-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Starlight Deployment

on:
workflow_run:
workflows: ["Build and Upload"]
types:
- completed

jobs:
deploy_to_nestsjs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

environment:
name: "starlight-nestjs"
url: ${{ vars.URL }}

steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: boilerplate-build
path: .

- name: Decode and create .env file
run: |
echo ${{ secrets.ENV }} | base64 -d > .env.nestsjs
- name: Copy Artifacts to server
run: |
sudo apt update && sudo apt install sshpass -y
sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.nestsjs ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/nestsjs
rm -f boilerplate.tar.gz .env.nestsjs
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /home/bingofe/boilerplate
rm -rf *
tar -xzf /tmp/nestsjs/boilerplate.tar.gz
mv /tmp/nestsjs/.env.nestsjs .env
rm -f /tmp/nestsjs/boilerplate.tar.gz
cp -r .next/standalone/* .
pm2 restart nestsjs-boilerplate --update-env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import {
Bot,
Box,
House,
List,
Expand All @@ -18,7 +19,7 @@ import { FC, ForwardRefExoticComponent, RefAttributes } from "react";
const sideItems = [
{
route: "Dashboard",
link: "/dashboard/admin/dashboard",
link: "/dashboard/admin",
icon: House,
id: "dashboard",
},
Expand Down Expand Up @@ -52,6 +53,12 @@ const sideItems = [
icon: TabletSmartphone,
id: "waitlist",
},
{
route: "FAQs",
link: "/dashboard/admin/faqs",
icon: Bot,
id: "faqs",
},
{
route: "Settings",
link: "/dashboard/admin/settings",
Expand Down

0 comments on commit 995c400

Please sign in to comment.