Skip to content

Commit

Permalink
feat: deploy github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
阮文涛 committed Oct 10, 2023
1 parent 0a6babc commit b74609c
Show file tree
Hide file tree
Showing 7 changed files with 1,183 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pages.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:
generate-pages:
name: Generate 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: '7288170423552131075'
OUTPUT_DIR: ./dist
uses: longbridgeapp/feishu-pages@main
- name: Build Pages
run: |
cp -r dist/docs ./
cp dist/docs.json ./
yarn
yarn 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vitepress/dist
.vitepress/cache
node_modules
53 changes: 53 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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 Pro Releases",
description: "Longbridge Pro Releases",
ignoreDeadLinks: true,
cleanUrls: true,
srcExclude: ['SUMMARY.md'],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
// { text: 'Home', link: '/' },
// { text: 'Releases', link: '/markdown-examples' },
{ text: 'GitHub', link: 'https://github.com/longbridgeapp/longbridge-pro-docs' }
],

sidebar: [
{
text: 'All Releases',
items: docsSidebar
}
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/longbridgeapp/longbridge-pro-docs' }
]
}
})
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
6 changes: 6 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: 首页
---

# 首页

25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "longbridge-pro-docs",
"description": "",
"version": "1.0.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/longbridgeapp/longbridge-pro-docs.git"
},
"author": "",
"license": "ISC",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview"
},
"bugs": {
"url": "https://github.com/longbridgeapp/longbridge-pro-docs/issues"
},
"homepage": "https://github.com/longbridgeapp/longbridge-pro-docs#readme",
"dependencies": {
"feishu-pages": "^0.4.1",
"vitepress": "^1.0.0-rc.20"
}
}
Loading

0 comments on commit b74609c

Please sign in to comment.