Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 40 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Checks

on:
pull_request:
branches: [dev, prod]
push:
branches: [dev]

concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "npm"
cache-dependency-path: "package-lock.json"

- name: Pin npm
run: npm install --global npm@11.17.0

- name: Install workspace dependencies
run: npm ci

- name: Build Client
run: npm run build:student

- name: Build Admin
run: npm run build:admin

- name: Check Server Runtime
run: npm run preflight
94 changes: 44 additions & 50 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,49 @@
name: Deploy to Production

on:
push:
branches:
- prod
push:
branches:
- prod

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install cloudflared
run: |
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o cloudflared.deb
sudo dpkg -i cloudflared.deb

- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
cat >> ~/.ssh/config <<EOF
Host ssh.codingclub.in
ProxyCommand cloudflared access ssh --hostname %h
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF

- name: Deploy
run: |
ssh cc@ssh.codingclub.in << 'EOF'
cd ~/Projects/CourseHub
git pull

# Install and build frontend
cd client
npm install
npm run build
rm -rf /var/www/coursehub/client/*
cp -r dist/* /var/www/coursehub/client/
cd ..

# Install and build admin
cd admin
npm install
npm run build
rm -rf /var/www/coursehub/admin/*
cp -r dist/* /var/www/coursehub/admin/
cd ..

# Install backend and reload PM2
cd server
npm install
pm2 reload coursehub-backend
EOF
deploy:
runs-on: ubuntu-latest
steps:
- name: Install cloudflared
run: |
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o cloudflared.deb
sudo dpkg -i cloudflared.deb

- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
cat >> ~/.ssh/config <<EOF
Host ssh.codingclub.in
ProxyCommand cloudflared access ssh --hostname %h
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF

- name: Deploy
run: |
ssh cc@ssh.codingclub.in << 'EOF'
cd ~/Projects/CourseHub
git pull

node server/scripts/preflight.js || exit 1
npm ci || exit 1

# Frontend
npm run build:student || exit 1
rm -rf /var/www/coursehub/client/*
cp -r client/dist/* /var/www/coursehub/client/

# Admin
npm run build:admin || exit 1
rm -rf /var/www/coursehub/admin/*
cp -r admin/dist/* /var/www/coursehub/admin/

pm2 reload coursehub-backend
EOF
42 changes: 0 additions & 42 deletions .github/workflows/test.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
node_modules
file-server
.env

access-token.token
refresh_token.token
onedrive-access-token.token
onedrive-refresh-token.token
~*
.DS_Store
.worktrees/

*.token*
onedrive-access-token.json*
.onedrive-refresh.lock*
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
engine-strict=true
engine-strict=true
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
~*
dist/
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"tabWidth": 4,
"singleQuote": false,
"printWidth": 100
}
}
Loading