Skip to content

Commit 69d4541

Browse files
author
Performance Optimizer
committed
� Add GitHub Pages deployment setup
✅ Added docs folder deployment: - Created docs/ folder with built frontend - Added GitHub Actions workflow for docs deployment - Updated deployment guide with docs folder instructions ✅ Added modern GitHub Actions deployment: - Created deploy-frontend.yml for modern GitHub Pages - Added proper permissions and concurrency settings - Supports both deployment methods ✅ Updated documentation: - Added two deployment options for GitHub Pages - Clear instructions for both /docs and GitHub Actions methods - Ready for immediate deployment
1 parent 9db2cca commit 69d4541

8 files changed

Lines changed: 293 additions & 12 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy to GitHub Pages (docs folder)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'webapp-react/**'
8+
- '.github/workflows/deploy-docs.yml'
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
cache-dependency-path: webapp-react/package-lock.json
25+
26+
- name: Install dependencies
27+
run: |
28+
cd webapp-react
29+
npm ci
30+
31+
- name: Build
32+
run: |
33+
cd webapp-react
34+
npm run build
35+
env:
36+
VITE_API_URL: ${{ secrets.VITE_API_URL || 'http://localhost:5000' }}
37+
38+
- name: Copy to docs folder
39+
run: |
40+
rm -rf docs/*
41+
cp -r webapp-react/dist/* docs/
42+
43+
- name: Commit and push
44+
run: |
45+
git config --local user.email "action@github.com"
46+
git config --local user.name "GitHub Action"
47+
git add docs/
48+
git diff --staged --quiet || git commit -m "Deploy frontend to docs folder [skip ci]"
49+
git push
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy Frontend to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'webapp-react/**'
8+
- '.github/workflows/deploy-frontend.yml'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build-and-deploy:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '18'
32+
cache: 'npm'
33+
cache-dependency-path: webapp-react/package-lock.json
34+
35+
- name: Install dependencies
36+
run: |
37+
cd webapp-react
38+
npm ci
39+
40+
- name: Build
41+
run: |
42+
cd webapp-react
43+
npm run build
44+
env:
45+
VITE_API_URL: ${{ secrets.VITE_API_URL || 'http://localhost:5000' }}
46+
47+
- name: Setup Pages
48+
uses: actions/configure-pages@v4
49+
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: webapp-react/dist
54+
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

DEPLOYMENT_GUIDE.md

Lines changed: 97 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,108 @@ curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
8989

9090
## Деплой Frontend (GitHub Pages)
9191

92-
### 1. Настройка GitHub Actions
92+
### Вариант 1: Использование папки `/docs` (рекомендуется)
9393

94-
Создайте файл `.github/workflows/deploy.yml`:
94+
#### 1. Настройка GitHub Actions
95+
96+
Создайте файл `.github/workflows/deploy-docs.yml` (уже создан):
9597

9698
```yaml
97-
name: Deploy to GitHub Pages
99+
name: Deploy to GitHub Pages (docs folder)
98100

99101
on:
100102
push:
101103
branches: [ main ]
102-
pull_request:
104+
paths:
105+
- 'webapp-react/**'
106+
- '.github/workflows/deploy-docs.yml'
107+
workflow_dispatch:
108+
109+
jobs:
110+
build-and-deploy:
111+
runs-on: ubuntu-latest
112+
113+
steps:
114+
- name: Checkout
115+
uses: actions/checkout@v4
116+
117+
- name: Setup Node.js
118+
uses: actions/setup-node@v4
119+
with:
120+
node-version: '18'
121+
cache: 'npm'
122+
cache-dependency-path: webapp-react/package-lock.json
123+
124+
- name: Install dependencies
125+
run: |
126+
cd webapp-react
127+
npm ci
128+
129+
- name: Build
130+
run: |
131+
cd webapp-react
132+
npm run build
133+
env:
134+
VITE_API_URL: ${{ secrets.VITE_API_URL || 'http://localhost:5000' }}
135+
136+
- name: Copy to docs folder
137+
run: |
138+
rm -rf docs/*
139+
cp -r webapp-react/dist/* docs/
140+
141+
- name: Commit and push
142+
run: |
143+
git config --local user.email "action@github.com"
144+
git config --local user.name "GitHub Action"
145+
git add docs/
146+
git diff --staged --quiet || git commit -m "Deploy frontend to docs folder [skip ci]"
147+
git push
148+
```
149+
150+
#### 2. Настройка GitHub Pages
151+
152+
1. Зайдите в Settings → Pages
153+
2. Source: "Deploy from a branch"
154+
3. Branch: `main`
155+
4. Folder: `/docs`
156+
5. Добавьте секрет `VITE_API_URL` с URL вашего бэкенда
157+
158+
### Вариант 2: Использование GitHub Actions (современный способ)
159+
160+
#### 1. Настройка GitHub Actions
161+
162+
Создайте файл `.github/workflows/deploy-frontend.yml` (уже создан):
163+
164+
```yaml
165+
name: Deploy Frontend to GitHub Pages
166+
167+
on:
168+
push:
103169
branches: [ main ]
170+
paths:
171+
- 'webapp-react/**'
172+
- '.github/workflows/deploy-frontend.yml'
173+
workflow_dispatch:
174+
175+
permissions:
176+
contents: read
177+
pages: write
178+
id-token: write
179+
180+
concurrency:
181+
group: "pages"
182+
cancel-in-progress: false
104183
105184
jobs:
106185
build-and-deploy:
107186
runs-on: ubuntu-latest
108187
109188
steps:
110189
- name: Checkout
111-
uses: actions/checkout@v3
190+
uses: actions/checkout@v4
112191
113192
- name: Setup Node.js
114-
uses: actions/setup-node@v3
193+
uses: actions/setup-node@v4
115194
with:
116195
node-version: '18'
117196
cache: 'npm'
@@ -127,16 +206,22 @@ jobs:
127206
cd webapp-react
128207
npm run build
129208
env:
130-
VITE_API_URL: ${{ secrets.VITE_API_URL }}
209+
VITE_API_URL: ${{ secrets.VITE_API_URL || 'http://localhost:5000' }}
131210
132-
- name: Deploy to GitHub Pages
133-
uses: peaceiris/actions-gh-pages@v3
211+
- name: Setup Pages
212+
uses: actions/configure-pages@v4
213+
214+
- name: Upload artifact
215+
uses: actions/upload-pages-artifact@v3
134216
with:
135-
github_token: ${{ secrets.GITHUB_TOKEN }}
136-
publish_dir: ./webapp-react/dist
217+
path: webapp-react/dist
218+
219+
- name: Deploy to GitHub Pages
220+
id: deployment
221+
uses: actions/deploy-pages@v4
137222
```
138223

139-
### 2. Настройка GitHub Pages
224+
#### 2. Настройка GitHub Pages
140225

141226
1. Зайдите в Settings → Pages
142227
2. Source: "GitHub Actions"

docs/assets/index-B4N8t8La.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/index-BtX4MNVs.js

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/cursor-font.png

77.7 KB
Loading

docs/cursor.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/png" href="/cursor-font.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
7+
<meta name="theme-color" content="#0b0b0b" media="(prefers-color-scheme: dark)" />
8+
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" />
9+
<title>GLV2 App</title>
10+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
11+
<script src="https://telegram.org/js/telegram-web-app.js"></script>
12+
<script>
13+
// initial theme (localStorage or prefers-color-scheme)
14+
(function(){
15+
try{
16+
const saved = localStorage.getItem('theme');
17+
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
18+
const isDark = saved ? saved === 'dark' : prefersDark;
19+
if(isDark) document.documentElement.classList.add('dark');
20+
}catch(e){}
21+
})();
22+
</script>
23+
<script type="module" crossorigin src="/assets/index-BtX4MNVs.js"></script>
24+
<link rel="stylesheet" crossorigin href="/assets/index-B4N8t8La.css">
25+
</head>
26+
<body>
27+
<div id="root"></div>
28+
</body>
29+
</html>

0 commit comments

Comments
 (0)