Skip to content

Commit fedd492

Browse files
Merge pull request #3 from madijonovsardorbek544-cmyk/deploy-react-app-to-github-pages
Add GitHub Pages deployment (Vite base + GitHub Actions)
2 parents 37b4f8d + 8d6a6be commit fedd492

4 files changed

Lines changed: 107 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
30+
- name: Install dependencies
31+
run: |
32+
if [ -f package-lock.json ]; then
33+
npm ci
34+
else
35+
npm install
36+
fi
37+
38+
- name: Run tests if present
39+
run: |
40+
if find src -type f \( -name '*.test.*' -o -name '*.spec.*' \) | grep -q .; then
41+
npm test
42+
else
43+
echo "No test files found; skipping tests."
44+
fi
45+
46+
- name: Build
47+
run: npm run build
48+
49+
- name: Configure GitHub Pages
50+
uses: actions/configure-pages@v5
51+
52+
- name: Upload Pages artifact
53+
uses: actions/upload-pages-artifact@v3
54+
with:
55+
path: dist
56+
57+
deploy:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
.env.local
4+
.env.*.local

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Cross-Border Scam Safety for International Students
22

3+
## Live Demo
4+
5+
Use the app here:
6+
7+
https://madijonovsardorbek544-cmyk.github.io/cross-border-scam-analyzer/
8+
9+
The live site is hosted with GitHub Pages and automatically redeploys when changes are pushed to the `main` branch.
10+
11+
## Repository Website Link
12+
13+
After GitHub Pages is enabled, add the live demo URL to the repository “About” section website field so visitors can open the app directly from the repo header.
14+
315
## One-line positioning
416

517
A privacy-first scam prevention MVP that helps international students, families, and education institutions detect risk indicators in scholarship, visa, admission, housing, payment, test-registration, document, and education-agent messages.
@@ -110,6 +122,30 @@ npm run build
110122
npm test
111123
```
112124

125+
## Deployment
126+
127+
Install dependencies:
128+
129+
```bash
130+
npm install
131+
```
132+
133+
Start the local Vite development server:
134+
135+
```bash
136+
npm run dev
137+
```
138+
139+
Create a production build for GitHub Pages:
140+
141+
```bash
142+
npm run build
143+
```
144+
145+
GitHub Pages deploys automatically through GitHub Actions when changes are pushed to the `main` branch. The deployment workflow builds the Vite app and publishes the `dist` folder to GitHub Pages.
146+
147+
If the site does not appear after the workflow succeeds, go to **Repository Settings → Pages → Source → GitHub Actions** and confirm GitHub Pages is enabled for Actions-based deployments.
148+
113149
## Environment setup
114150

115151
Copy `.env.example` to `.env.local` only if you want Firebase-backed anonymized report storage.

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
33

44
export default defineConfig({
5+
base: '/cross-border-scam-analyzer/',
56
plugins: [react()],
67
});

0 commit comments

Comments
 (0)