Skip to content

Commit 30cd638

Browse files
committed
feat: github action for demo.
1 parent 91f012c commit 30cd638

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and Deploy Demo
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Укажите ветку, которую хотите использовать для деплоя
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Build demo
25+
run: npm run build:demo
26+
27+
- name: Deploy to GitHub Pages
28+
uses: peaceiris/actions-gh-pages@v3
29+
with:
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
publish_dir: ./dist/demo

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +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",
1314
"prepare": "npm run build"
1415
},
1516
"keywords": [

src/demo/demo.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title><%= htmlWebpackPlugin.options.title %></title>
7+
</head>
8+
<body>
9+
<div id="tech-particles"></div>
10+
</body>
11+
</html>

src/demo/webpack.demo.config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const path = require('path');
2+
const CopyWebpackPlugin = require('copy-webpack-plugin');
3+
const HtmlWebpackPlugin = require('html-webpack-plugin');
4+
5+
module.exports = {
6+
entry: './demo.js',
7+
mode: 'production',
8+
output: {
9+
filename: 'webgl-tech-particles.demo.js',
10+
path: path.resolve(__dirname, '../dist/demo'),
11+
clean: true,
12+
},
13+
module: {
14+
rules: [
15+
{
16+
test: /\.js$/,
17+
exclude: /node_modules/,
18+
use: {
19+
loader: 'babel-loader',
20+
options: {
21+
presets: ['@babel/preset-env'],
22+
},
23+
},
24+
},
25+
{
26+
test: /\.css$/,
27+
use: ['style-loader', 'css-loader'],
28+
},
29+
{
30+
test: /\.(png|jpg|gif|webp)$/,
31+
type: 'asset/resource',
32+
generator: {
33+
filename: 'assets/icons/[name][ext]',
34+
},
35+
},
36+
],
37+
},
38+
plugins: [
39+
new CopyWebpackPlugin({
40+
patterns: [
41+
{ from: '../settings.json', to: 'settings.json' },
42+
{ from: '../src/assets/icons', to: 'assets/icons' },
43+
],
44+
}),
45+
new HtmlWebpackPlugin({
46+
template: './demo.html',
47+
filename: 'demo.html',
48+
title: 'WebGL Tech Particles Demo',
49+
}),
50+
],
51+
};

0 commit comments

Comments
 (0)