Skip to content

Commit

Permalink
🐎 ci: 增加文档自动部署
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoJikun committed Nov 1, 2023
1 parent 90e9d39 commit 92b7acc
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 25 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: pnpm install # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
pnpm docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: packages/docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
outputs:
page_url: "https://ce.ivy-design.press"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ types

test-results/
playwright-report/

packages/docs/src/.vitepress/.temp/
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"vue": "^3.3.4"
},
"devDependencies": {
"vitepress": "1.0.0-rc.20"
"vitepress": "1.0.0-rc.24"
}
}
25 changes: 14 additions & 11 deletions packages/docs/src/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ export default defineConfig({
nav,
sidebar,
outline: [2, 3],
outlineTitle: '章节目录',
outlineTitle: "章节目录",
socialLinks: [
{ icon: "github", link: "https://github.com/vuejs/vitepress" },
],
search:{
provider: 'local'
}
search: {
provider: "local",
},
},
vue: {
template: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith("ivy-"),
},
},
},
sitemap: {
hostname: "https://ce.ivy-design.press",
},
vue:{
template:{
compilerOptions:{
isCustomElement: tag => tag.startsWith('ivy-')
}
}
}
});
8 changes: 4 additions & 4 deletions packages/docs/src/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { h } from "vue";
import Theme from "vitepress/theme";
import "./style.css";
import { registerComponents } from "@ivy-design/wc";
import "@ivy-design/wc/dist/style.css";
import { registerComponents } from "@ivy-design/ce";
import "@ivy-design/ce/dist/style.css";

export default {
...Theme,
Expand All @@ -12,8 +12,8 @@ export default {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
});
},
enhanceApp({ app, router, siteData }) {
enhanceApp(ctx) {
// ...
registerComponents();
if (ct) registerComponents();
},
};
2 changes: 1 addition & 1 deletion packages/docs/src/components/clipboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
```

<script setup>
import { message } from '@ivy-design/wc'
import { message } from '@ivy-design/ce'
const clipboardCopy = (ev) => {
console.log(ev)
message.success("Copied! content is " + ev.detail)
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/components/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<script setup>
import { onMounted } from 'vue';
import { message } from '@ivy-design/wc'
import { message } from '@ivy-design/ce'
onMounted(()=>{
console.log(message)
document.getElementById('btn').addEventListener('click', ()=>{
Expand Down
9 changes: 9 additions & 0 deletions packages/ivy-design-wc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"package.json",
"README.md"
],
"keywords": [
"front-end",
"component",
"vue",
"web-component",
"webComponent",
"web component",
"ivy-design"
],
"license": "MIT",
"scripts": {
"dev": "vite build -w",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 92b7acc

Please sign in to comment.