Skip to content

Commit

Permalink
First commit & Add CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Oct 16, 2023
0 parents commit ed01b8c
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Feishu Pages Export
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Exporting
env:
FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }}
FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }}
FEISHU_SPACE_ID: '7288219896826494980'
OUTPUT_DIR: ./dist
uses: longbridgeapp/feishu-pages@main
- uses: oven-sh/setup-bun@v1
- name: Build Pages
run: |
cp -r dist/docs ./
cp dist/docs.json ./
bun install & bun run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: '.vitepress/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
dist/
docs/
node_modules/
50 changes: 50 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { DefaultTheme, defineConfig } from 'vitepress';

import docs from '../docs.json';

/**
* Convert feishu-pages's docs.json into VitePress's sidebar config
* @param docs from `docs.json`
* @returns
*/
const convertDocsToSidebars = (docs: any) => {
const sidebars: DefaultTheme.SidebarItem[] = [];
for (const doc of docs) {
let sidebar: DefaultTheme.SidebarItem = {
text: doc.title,
link: '/docs/' + doc.slug,
};
if (doc.children.length > 0) {
sidebar.items = convertDocsToSidebars(doc.children);
}
sidebars.push(sidebar);
}

return sidebars;
};

const docsSidebar = convertDocsToSidebars(docs);

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'Longbridge Whale Docs',
base: '/whale-docs/',
ignoreDeadLinks: true,
cleanUrls: true,
srcExclude: ['SUMMARY.md'],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [{ text: 'Home', link: '/' }],

sidebar: [
{
text: 'Docs',
items: docsSidebar,
},
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/longbridgeapp/whale-docs' },
],
},
});
4 changes: 4 additions & 0 deletions .vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import DefaultTheme from 'vitepress/theme';
import '../../style.scss';

export default DefaultTheme;
Binary file added bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Empty file added index.md
Empty file.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"scripts": {
"build": "bun feishu-pages build"
},
"dependencies": {
"feishu-pages": "^0.4.1",
"vitepress": "^1.0.0-rc.22"
}
}

0 comments on commit ed01b8c

Please sign in to comment.