Skip to content

Commit ee244a5

Browse files
committed
add github action to build demo pages
1 parent 8f272ec commit ee244a5

2 files changed

Lines changed: 50 additions & 19 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- demo
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v4
19+
20+
- name: Install dependencies
21+
run: npm install
22+
23+
- name: Build project
24+
run: npm run build
25+
26+
- name: Upload production-ready build files
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: production-files
30+
path: ./dist
31+
32+
deploy:
33+
name: Deploy
34+
needs: build
35+
runs-on: ubuntu-latest
36+
if: github.ref == 'refs/heads/demo'
37+
38+
steps:
39+
- name: Download artifact
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: production-files
43+
path: ./dist
44+
45+
- name: Deploy to GitHub Pages
46+
uses: peaceiris/actions-gh-pages@v4
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./dist

vite.config.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
1-
import { dirname, resolve } from 'node:path'
2-
import { fileURLToPath } from 'node:url'
31
import { defineConfig } from 'vite'
42
import vue from '@vitejs/plugin-vue'
5-
import dts from 'vite-plugin-dts';
63
import tailwindcss from '@tailwindcss/vite';
74

8-
const __dirname = dirname(fileURLToPath(import.meta.url))
9-
105
export default defineConfig({
116
plugins: [
127
vue(),
13-
dts({ rollupTypes: true }),
148
tailwindcss()
159
],
10+
base: '/vvplot/',
1611
build: {
17-
lib: {
18-
entry: {
19-
index: resolve(__dirname, 'src/index.ts'),
20-
components: resolve(__dirname, 'src/components/index.ts'),
21-
scale: resolve(__dirname, 'src/js/scale.js'),
22-
label: resolve(__dirname, 'src/js/label.js'),
23-
theme: resolve(__dirname, 'src/js/theme.js'),
24-
},
25-
name: 'VVPlot',
26-
formats: ['es'],
27-
cssFileName: "style"
28-
},
2912
rollupOptions: {
30-
external: ['vue'],
3113
output: {
3214
globals: {
3315
vue: 'Vue',

0 commit comments

Comments
 (0)