Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add vuepress for github pages
  • Loading branch information
Suzukaze7 committed Apr 17, 2024
commit 76339323704c19a9cfa49b29e4a702585a9836da
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: docs

on:
# 每当 push 到 main 分支时触发部署
push:
branches: [main]
# 手动触发部署
workflow_dispatch:

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
# 选择要使用的 pnpm 版本
version: 8
# 使用 pnpm 安装依赖
run_install: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
# 选择要使用的 node 版本
node-version: 20
# 缓存 pnpm 依赖
cache: pnpm

# 运行构建脚本
- name: Build VuePress site
run: pnpm docs:build

# 查看 workflow 的文档来获取更多信息
# @see https://github.com/crazy-max/ghaction-github-pages
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v4
with:
# 部署到 gh-pages 分支
target_branch: gh-pages
# 部署目录为 VuePress 的默认输出目录
build_dir: .vuepress/dist
env:
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
*.exe
*.out
*.app

# vuepress
node_modules/
.vuepress/.cache/
.vuepress/.temp/
.vuepress/.dist/
53 changes: 53 additions & 0 deletions .vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { viteBundler } from '@vuepress/bundler-vite';
import { defineUserConfig } from 'vuepress';
import { logoPath, repoBase, repoName, repoUrl } from './params';
import { hopeTheme, mdEnhance } from 'vuepress-theme-hope';
import { searchProPlugin } from 'vuepress-plugin-search-pro';

const tutorialPath = '/md/';
const srcCodePath = tutorialPath + '详细分析/';

export default defineUserConfig({
base: repoBase + '/',
title: repoName,
description: repoName,
lang: 'zh-CN',
theme: hopeTheme({
sidebar: [
{ text: '首页', link: '/', },
{ text: '基本概念', link: tutorialPath + '01基本概念', },
{ text: '使用线程', link: tutorialPath + '02使用线程', },
{ text: '共享数据', link: tutorialPath + '03共享数据', },
{ text: '同步操作', link: tutorialPath + '04同步操作', },
{
text: '详细分析', link: srcCodePath,
collapsible: true,
children: [
{ text: 'std::thread 的构造-源码解析', link: srcCodePath + '01thread的构造与源码解析', },
{ text: 'std::scoped_lock 的源码实现与解析', link: srcCodePath + '02scoped_lock源码解析', },
{ text: 'std::async 与 std::future 源码解析', link: srcCodePath + '03async与future源码解析', },
]
},
],
favicon: logoPath,
logo: logoPath,
navTitle: repoName,
repo: repoUrl,
editLinkPattern: repoUrl + 'blob/main/:path',
contributors: false,
darkmode: 'toggle',
pageInfo: ['ReadingTime'],
}),
plugins: [
mdEnhance({
footnote: true,
imgLazyload: true
}),
searchProPlugin({
indexContent: true,
autoSuggestions: true
})
],

bundler: viteBundler({}),
})
7 changes: 7 additions & 0 deletions .vuepress/params.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// 不同仓库需要修改的值
const logoPath = '/image/现代C++并发编程教程.png';
const repoName = '现代C++并发编程教程';
const repoBase = '/ModernCpp-ConcurrentProgramming-Tutorial';
const repoUrl = `https://github.com/Mq-b${repoBase}/`;

export { repoUrl, repoBase, repoName, logoPath }
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">

<a herf="https://zh.cppreference.com/w/cpp/thread">
<img src="image/现代C++并发编程教程.png" width=512px alt="cpp"/>
<img src="/image/现代C++并发编程教程.png" width=512px alt="cpp"/>
</a>

# 现代C++并发编程教程
Expand Down
6 changes: 3 additions & 3 deletions image/捐赠/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div align="center">

<img src="支付宝10.jpg" width=256px alt="cpp"/>
<img src="./支付宝10.jpg" width=256px alt="cpp"/>

<img src="支付宝20.jpg" width=256px alt="cpp"/>
<img src="./支付宝20.jpg" width=256px alt="cpp"/>

<img src="支付宝88.88.jpg" width=256px alt="cpp"/>
<img src="./支付宝88.88.jpg" width=256px alt="cpp"/>

</div>

Expand Down
Loading