Skip to content

Commit 4c93294

Browse files
committed
feat: github action for demo.
1 parent 30cd638 commit 4c93294

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and Deploy Demo
33
on:
44
push:
55
branches:
6-
- main # Укажите ветку, которую хотите использовать для деплоя
6+
- main
77

88
jobs:
99
build-and-deploy:
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up Node.js
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: 18
19+
node-version: 22
2020

2121
- name: Install dependencies
2222
run: npm install
@@ -27,5 +27,5 @@ jobs:
2727
- name: Deploy to GitHub Pages
2828
uses: peaceiris/actions-gh-pages@v3
2929
with:
30-
github_token: ${{ secrets.GITHUB_TOKEN }}
31-
publish_dir: ./dist/demo
30+
github_token: ${{ secrets.ACTION }}
31+
publish_dir: dist/demo

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"start": "webpack serve",
1212
"build": "webpack --mode production",
13-
"build:demo": "webpack --config demo/webpack.demo.config.js --mode production",
13+
"build:demo": "webpack --config src/demo/webpack.demo.config.js --mode production",
1414
"prepare": "npm run build"
1515
},
1616
"keywords": [

src/demo/webpack.demo.config.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
44

55
module.exports = {
6-
entry: './demo.js',
6+
entry: './src/demo/demo.js', // Точка входа — demo.js
77
mode: 'production',
88
output: {
9-
filename: 'webgl-tech-particles.demo.js',
10-
path: path.resolve(__dirname, '../dist/demo'),
11-
clean: true,
9+
filename: 'webgl-tech-particles.demo.js', // Имя выходного файла
10+
path: path.resolve(__dirname, '../../dist/demo'), // Выходная папка — dist/demo
11+
clean: true, // Очистка папки перед сборкой
1212
},
1313
module: {
1414
rules: [
@@ -30,22 +30,24 @@ module.exports = {
3030
test: /\.(png|jpg|gif|webp)$/,
3131
type: 'asset/resource',
3232
generator: {
33-
filename: 'assets/icons/[name][ext]',
33+
filename: 'assets/icons/[name][ext]', // Иконки будут в assets/icons
3434
},
3535
},
3636
],
3737
},
3838
plugins: [
39+
// Копируем settings.json и иконки
3940
new CopyWebpackPlugin({
4041
patterns: [
41-
{ from: '../settings.json', to: 'settings.json' },
42-
{ from: '../src/assets/icons', to: 'assets/icons' },
42+
{ from: path.resolve(__dirname, '../../settings.json'), to: 'settings.json' },
43+
{ from: path.resolve(__dirname, '../assets/icons'), to: 'assets/icons' },
4344
],
4445
}),
46+
// Генерируем HTML-файл для демо
4547
new HtmlWebpackPlugin({
46-
template: './demo.html',
47-
filename: 'demo.html',
48-
title: 'WebGL Tech Particles Demo',
48+
template: path.resolve(__dirname, '../demo/demo.html'),
49+
filename: 'demo.html', // Имя выходного файла
50+
title: 'WebGL Tech Particles Demo', // Заголовок страницы
4951
}),
5052
],
5153
};

0 commit comments

Comments
 (0)