Skip to content

Commit

Permalink
✨ feat: deploy github page version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
xing403 committed Oct 11, 2023
1 parent 58e6797 commit ba3739d
Show file tree
Hide file tree
Showing 8 changed files with 4,455 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .vitepress/cache/deps/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"hash": "4a6ab71d",
"browserHash": "428fc6fa",
"hash": "e6761ca9",
"browserHash": "987682f0",
"optimized": {
"vue": {
"src": "../../../node_modules/.pnpm/[email protected]/node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "aab0901c",
"fileHash": "2cf0f4fe",
"needsInterop": false
},
"element-plus": {
"src": "../../../node_modules/.pnpm/[email protected][email protected]/node_modules/element-plus/es/index.mjs",
"file": "element-plus.js",
"fileHash": "70259424",
"fileHash": "bf93ae97",
"needsInterop": false
},
"xing-ly": {
"src": "../../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/xing-ly/dist/xing-ly.es.js",
"file": "xing-ly.js",
"fileHash": "670dd4c9",
"fileHash": "28b254c1",
"needsInterop": false
}
},
Expand Down
1 change: 0 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { defineConfig } from 'vitepress'
import { sidebar } from './sidebar'

export default defineConfig({
base: '/blog/',
head: [
['link', {
rel: 'icon',
Expand Down
1 change: 1 addition & 0 deletions .vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const sidebar = [
{ text: 'workflows', link: '/blogs/github/workflows' },
{ text: 'token', link: '/blogs/github/token' },
{ text: 'pages', link: '/blogs/github/pages' },
{ text: 'pages2', link: '/blogs/github/pages2' },
]
}, {
text: '其他blog',
Expand Down
37 changes: 37 additions & 0 deletions blogs/github/pages2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: GitHub pages2
layout: doc
---
# GitHub pages2
第二种配置自动部署方式
## 1. 创建新仓库
1. 创建一个新的仓库放置打包的文件
> 将仓库命名为 `<username>.github.io` -username 为用户名
## 2. 配置脚本
在项目的根目录下 deploy.sh 文件中添加如下脚本
```sh
#!/usr/bin/env sh
# 打包项目
pnpm run docs:build
# 切换到dist目录
cd .vitepress/dist/
# 将打包文件提交到新仓库中
git init
git add .
git commit -m 'deploy'
git push -f [email protected]:xing403/xing403.github.io.git master
```
## 3. 配置script 命令
在 package.json 文件中添加如下命令
```json
{
"scripts": {
"deploy:github": "deploy.sh"
}
}
```
## 4. 本地执行
在项目根目录下执行
```sh
pnpm run deploy:github
```
18 changes: 18 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env sh

# 打包生成静态文件
echo start build
pnpm run docs:build
echo start build end

# 进入待发布的 dist/ 目录
cd .vitepress/dist/
echo commit build files to git


git init
git add .
git commit -m 'deploy'
echo git push -f [email protected]:xing403/xing403.github.io.git master
git push -f [email protected]:xing403/xing403.github.io.git master
echo finish
Loading

0 comments on commit ba3739d

Please sign in to comment.