Skip to content

Commit 743fd76

Browse files
author
MuhammadTahaNasir
committed
Initial commit: all workflows and templates
0 parents  commit 743fd76

18 files changed

+321
-0
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Frontend
2+
NODE_ENV=production
3+
4+
# Backend
5+
NODE_ENV=production
6+
DATABASE_URL=postgresql://postgres:password@db:5432/appdb

.github/workflows/ci-ai.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: AI Project CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-ai:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Set up Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: '3.10'
15+
16+
- name: Install dependencies
17+
run: |
18+
pip install -r requirements.txt
19+
20+
- name: Run Tests
21+
run: pytest
22+
23+
- name: Convert Notebooks to HTML
24+
run: |
25+
mkdir -p html
26+
for notebook in notebooks/*.ipynb; do
27+
jupyter nbconvert --to html "$notebook" --output-dir html
28+
done
29+
30+
- name: Deploy to GitHub Pages
31+
uses: peaceiris/actions-gh-pages@v4
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./html

.github/workflows/ci-backend.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Backend CI & Deploy (Railway)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
backend-test-deploy:
9+
runs-on: ubuntu-latest
10+
defaults:
11+
run:
12+
working-directory: server
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
- run: npm install
19+
- run: npm test
20+
- name: Trigger Railway Deploy
21+
run: curl -X POST https://backboard.railway.app/webhook/${{ secrets.RAILWAY_DEPLOY_HOOK }}

.github/workflows/ci-frontend.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Frontend CI & Deploy (Vercel)
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-frontend:
7+
runs-on: ubuntu-latest
8+
defaults:
9+
run:
10+
working-directory: client
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
16+
17+
- run: npm install
18+
- run: npm run lint
19+
- run: npm run build
20+
21+
deploy-vercel:
22+
runs-on: ubuntu-latest
23+
needs: build-frontend
24+
steps:
25+
- uses: amondnet/vercel-action@v25
26+
with:
27+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
28+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
29+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
30+
working-directory: ./client
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docker Build & Push
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
docker:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Docker Buildx
13+
uses: docker/setup-buildx-action@v3
14+
- name: Log in to Docker Hub
15+
uses: docker/login-action@v3
16+
with:
17+
username: ${{ secrets.DOCKER_USERNAME }}
18+
password: ${{ secrets.DOCKER_PASSWORD }}
19+
20+
- name: Build & Push Client
21+
uses: docker/build-push-action@v5
22+
with:
23+
context: ./client
24+
push: true
25+
tags: yourdockerhubuser/mern-client:latest
26+
27+
- name: Build & Push Server
28+
uses: docker/build-push-action@v5
29+
with:
30+
context: ./server
31+
push: true
32+
tags: yourdockerhubuser/mern-server:latest
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy Static Site to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 20
15+
- run: npm install
16+
- run: npm run build
17+
- uses: peaceiris/actions-gh-pages@v4
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
publish_dir: ./build
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Deploy to Heroku
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Deploy to Heroku
14+
uses: akhileshns/heroku-deploy@v3.12.12
15+
with:
16+
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
17+
heroku_app_name: your-app-name
18+
heroku_email: your-email@example.com
19+
usedocker: false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Auto Lint & Format
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
format:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
11+
with:
12+
node-version: 20
13+
- run: npm ci
14+
- run: npx prettier --write .
15+
- run: npx eslint . --fix
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Deploy to Render
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
trigger:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Trigger Render deploy
12+
run: |
13+
curl -X POST https://api.render.com/deploy/srv-xxxxxxxxxx?key=${{ secrets.RENDER_DEPLOY_KEY }}

.github/workflows/vps-deploy.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Deploy to Private VPS
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up SSH
13+
run: |
14+
mkdir -p ~/.ssh
15+
echo "${{ secrets.VPS_KEY }}" > ~/.ssh/id_rsa
16+
chmod 600 ~/.ssh/id_rsa
17+
ssh-keyscan -H your.vps.ip >> ~/.ssh/known_hosts
18+
19+
- name: Rsync to VPS
20+
run: rsync -avz --exclude=".git" ./ youruser@your.vps.ip:/var/www/your-app
21+
22+
- name: Restart App on VPS
23+
run: ssh youruser@your.vps.ip 'cd /var/www/your-app && docker-compose up -d --build'

0 commit comments

Comments
 (0)