Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support preview #469

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading