Skip to content

Commit

Permalink
Merge pull request #1057 from hngprojects/dev
Browse files Browse the repository at this point in the history
Merge to staging
  • Loading branch information
ThePrimeJnr authored Aug 22, 2024
2 parents 8c2adec + 9b02be2 commit 42d144b
Show file tree
Hide file tree
Showing 330 changed files with 21,329 additions and 22,770 deletions.
3 changes: 2 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ API_URL=https://your-teams-backend-url.com
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
AUTH_SECRET=
NEXTAUTH_URL=https://your-application-deployment
NEXTAUTH_URL=https://your-application-deployment
NODE_ENV="development" // change for deployment
97 changes: 97 additions & 0 deletions .github/workflows/anchor-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
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
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: ".env.java,boilerplate.tar.gz"
target: "/tmp/java"

- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd hng_boilerplate_nextjs
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 nextjs_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
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: ".env.python,boilerplate.tar.gz"
target: "/tmp/python"

- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd hng_boilerplate_nextjs
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 nextjs_boilerplate --update-env
32 changes: 0 additions & 32 deletions .github/workflows/build-and-push.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Upload

on:
push:
branches:
- dev

jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.fork == false

steps:
- 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
6 changes: 6 additions & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ jobs:

- name: Run tests
run: pnpm run test:ci

- name: Upload coverage reports
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/
53 changes: 53 additions & 0 deletions .github/workflows/bulldozer-php-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Bulldozer PHP Deployment

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

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

environment:
name: "bulldozer-php"
url: ${{ vars.URL }}

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

- 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: Copy Artifacts to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "boilerplate.tar.gz"
target: "/var/www/boilerplate_fe/dev"

- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /var/www/boilerplate_fe/dev
rm -rf .next
rm -rf public
tar -xzf boilerplate.tar.gz
rm -f boilerplate.tar.gz
pm2 restart boilerplate-frontend --update-env
11 changes: 8 additions & 3 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@ name: Coverage Report

on:
workflow_run:
workflows: ["build-lint-test"]
workflows: ["Build, Lint and Test"]
types:
- completed

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

permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4

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

- name: "Coverage Report"
if: always()
uses: davelosert/vitest-coverage-report-action@v2
38 changes: 31 additions & 7 deletions .github/workflows/dev-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,50 @@ name: Dev Deployment

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

jobs:
jobs:
deploy_to_dev:
if: github.event.repository.fork == false
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

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

steps:
- name: Deploy to dev environment
uses: appleboy/[email protected]
- 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 }} | base64 -d > .env
- name: Copy Artifacts to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: ".env,boilerplate.tar.gz"
target: "~/hng_boilerplate_nextjs"

- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd hng_boilerplate_nextjs
./scripts/dev_deploy.sh
cd ~/hng_boilerplate_nextjs
tar -xzf boilerplate.tar.gz
rm -f boilerplate.tar.gz
cp -r .next/standalone/* .
# pm2 restart nextjs_boilerplate --update-env
Loading

0 comments on commit 42d144b

Please sign in to comment.