Skip to content

Commit 3888280

Browse files
committed
fix: fix build
1 parent 7864560 commit 3888280

7 files changed

Lines changed: 71 additions & 7 deletions

File tree

.github/workflows/auto-deploy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Auto Deploy
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
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: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v3
26+
with:
27+
version: 9
28+
- name: Install deps
29+
run: pnpm i
30+
- name: Build common
31+
run: pnpm build:common
32+
- name: Build home
33+
run: pnpm build
34+
env:
35+
VITE_CONTEXT: /opentiny.design/
36+
VITE_BASE: /opentiny.design/
37+
- name: Copy files
38+
run: |
39+
cp dist/common/tinyui-design-common.iife.js dist/home
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v2
42+
- name: Build with Jekyll
43+
uses: actions/jekyll-build-pages@v1
44+
with:
45+
source: ./dist/home
46+
destination: ./_site
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v3
49+
50+
# Deployment job
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ cache
77
.temp
88
.eslintcache
99

10+
tinydoc-design
11+
1012
# local env
1113
.env.local
1214
.env.*.local

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"name": "root-opentiny-design",
33
"private": true,
44
"scripts": {
5-
"dev": "pnpm -F opentiny-design-home dev"
5+
"dev": "pnpm -F opentiny-design-home dev",
6+
"build:common": "pnpm -F opentiny-design-common build:open",
7+
"build": "pnpm -F opentiny-design-home build"
68
}
79
}

packages/home/env/.env.open

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
VITE_CONTEXT=/
2-
VITE_ENV_MODE='open'
2+
VITE_ENV_MODE='open'
3+
VITE_BASE=/

packages/home/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div id="header"></div>
1818
<div id="app"></div>
1919
<!-- prettier-ignore -->
20-
<script id="tinyui-design-common" src="https://res.hc-cdn.com/tinyui-design/1.1.0.20241203195032/common/tinyui-design-common.iife.js"></script>
20+
<script id="tinyui-design-common" src="https://opentiny.github.io/opentiny.design/tinyui-design-common.iife.js"></script>
2121
<script type="module" src="./src/main.js"></script>
2222
</body>
2323
</html>

packages/home/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"version": "0.1.0",
55
"scripts": {
66
"dev": "pnpm start",
7+
"build": "pnpm build:open",
8+
"preview": "vite preview --mode open",
79
"start": "node copy-docs.js && vite --mode open",
810
"build:open": "node copy-docs.js && vite build --mode open",
911
"analyze": "node copy-docs.js && vite build --mode analyze",

packages/home/vite.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ export default defineConfig(({ command, mode }) => {
7777
define: {
7878
'process.env': { TINY_MODE: 'pc' }
7979
},
80-
base:
81-
command === 'build'
82-
? `${process.env.static_url_prefix}/tinyui-design/${process.env.staticReleaseVersion}/home/`
83-
: '/',
80+
base: process.env.VITE_BASE || '/',
8481
build: {
8582
outDir: '../../dist/home',
8683
commonjsOptions: {

0 commit comments

Comments
 (0)