Skip to content

Commit

Permalink
feat: support preview (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Apr 7, 2024
1 parent 77b1a83 commit f973a5f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/preview-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 文件名建议统一为 preview-publish
# 应用 preview.yml 的 demo
name: PREVIEW_PUBLISH

on:
workflow_run:
workflows: ['MAIN_PULL_REQUEST']
types:
- completed

jobs:
build-site:
runs-on: ubuntu-latest
steps:
- name: build-site
run: npm run site:preview
call-preview:
uses: Tencent/tdesign/.github/workflows/preview.yml@main
secrets:
TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build:components": "pnpm run --filter 'tdesign-site-components' build && pnpm run --filter 'tdesign-site-components' postbuild",
"site": "npm run build:components && cd site && npm run build",
"site:intranet": "npm run build:components && cd site && npm run site:intranet",
"site:preview": "npm run build:components && cd site && npm run site:preview",
"prepare": "husky install"
},
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"preview": "vite preview",
"site": "run-s build",
"site:intranet": "vite build --mode intranet",
"site:preview": "vite build --mode preview",
"lint:fix": "eslint --ext .vue,.js,.ts,.tsx ./src --fix"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion site/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import tdocPlugin from './plugin-tdoc/index.js';

const publicPathMap = {
intranet: '/',
preview: '/',
production: 'https://static.tdesign.tencent.com/',
};

Expand All @@ -23,7 +24,7 @@ export default ({ mode }) => {
},
},
build: {
outDir: '_site',
outDir: mode === 'preview' ? '../_site' : '_site',
rollupOptions: {
input: {
index: path.resolve(__dirname, 'index.html'),
Expand Down

0 comments on commit f973a5f

Please sign in to comment.