Skip to content

Commit

Permalink
🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
oddfar committed Feb 17, 2023
0 parents commit c08d6be
Show file tree
Hide file tree
Showing 39 changed files with 1,237 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

#on: [push]

# 在master分支发生push事件时触发。
on:
push:
branches:
- master

jobs: # 工作流
build: # 自定义名称
runs-on: ubuntu-latest #运行在虚拟机环境ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps: # 步骤
# 步骤1
- name: Checkout
# 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions
uses: actions/checkout@v1

- name: Use Node.js ${{ matrix.node-version }} # 步骤2
uses: actions/setup-node@v1 # 作用:安装nodejs
with:
node-version: ${{ matrix.node-version }} # 版本
# 步骤2:执行脚本deploy.sh
- name: run deploy.sh
env: # 设置环境变量,未设置则不运行
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # toKen私密变量
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} # gitee的ssh

run: npm install && npm run deploy

17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# npm
package-lock.json
node_modules

# vscode
.vscode

# vuepress
docs/.vuepress/dist

# 百度链接推送
urls.txt
### mac ###
.DS_Store
**/.DS_Store
.DS_Store?
.DS_Store
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
使用 [vuepress](https://vuepress.vuejs.org/zh) 搭建,自动部署在[GitHub Pages](https://pages.github.com/)



> 在线浏览地址:
- 国外:<https://oddfar.github.io/notes/>
- 国内:<https://note.oddfar.com/>

笔记内容若有任何问题,请各位大佬斧正!

觉得有用的话,麻烦各位大佬帮忙点个 star ,满足一下我的虚荣心。



> 学习路线
尚硅谷的java学习路线:<https://www.bilibili.com/read/cv5216534>

狂神的java视频地址:<https://www.bilibili.com/read/cv5702420>



> 项目部署
查看此处:<https://oddfar.github.io/notes/about/>

1 change: 1 addition & 0 deletions base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = '/'
72 changes: 72 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env sh

# 确保脚本抛出遇到的错误
set -e

initDist(){
echo $1 > base.js
}



#------------------------------------------

#url访问目录,这个是你 github 仓库的名字
initDist "module.exports = '/notes/'"

# 生成静态文件
npm run build
# 进入生成的文件夹
cd docs/.vuepress/dist

# deploy to github
if [ -z "$GITHUB_TOKEN" ]; then
# 手动部署
msg='deploy'
[email protected]:oddfar/notes.git
else
# 自动部署
msg='来自github actions的自动部署'
githubUrl=https://oddfar:${GITHUB_TOKEN}@github.com/oddfar/notes.git
git config --global user.name "oddfar"
git config --global user.email "[email protected]"
fi
git init
git add -A
git commit -m "${msg}"
git push -f $githubUrl master:gh-pages # 推送到github


cd - # 退回开始所在目录
rm -rf docs/.vuepress/dist

#------------------------------------------


#打包代码同步到 gitee gh-pages分支
if [ -z "$SSH_PRIVATE_KEY" ]; then
echo '如果是空字符串,则不部署到gitee'
else
#url访问目录
initDist "module.exports = '/'"
# 生成静态文件
npm run build
# 进入生成的文件夹
cd docs/.vuepress/dist

[email protected]:oddfar/notes.git #gitee 仓库ssh地址

git config --global user.name "oddfar"
git config --global user.email "[email protected]"
git init
git add -A
git commit -m "来自github actions的自动部署"
git push -f $giteeUrl master:gh-pages

cd - # 退回开始所在目录
rm -rf docs/.vuepress/dist
# 删除秘钥
rm -rf ~/.ssh
fi


28 changes: 28 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const plugins = require('./config/plugins.js');
const base = require('../../base.js');
const themeConfig = require('./config/themeConfig.js');



module.exports = {
theme: 'vdoing', // 使用npm包主题
// theme: require.resolve('../../theme-vdoing'), // 使用本地主题
port: 8080,//端口

plugins,
themeConfig,
base, //引入后缀

title: "Campus",
description: 'Campus 一款简单的后台管理系统,快速开发框架,适合大学生开发毕设,或其他小项目。', // 描述,以 <meta> 标签渲染到页面html中

head: [
['link', { rel: 'icon', href: '/img/favicon.ico' }],
['meta', { name: 'keywords', content: 'oddfar,zhiyuan,campus' }],
['meta', { name: 'theme-color', content: '#11a8cd' }], // 移动浏览器主题颜色
],
markdown: {
lineNumbers: true, // 代码行号
extractHeaders: [ 'h2', 'h3', 'h4', 'h5', 'h6' ]
},
}
75 changes: 75 additions & 0 deletions docs/.vuepress/config/plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//插件
module.exports = [
//本地插件
[require('../plugins/love-me'), { // 鼠标点击爱心特效
color: '#11a8cd', // 爱心颜色,默认随机色
excludeClassName: 'theme-vdoing-content' // 要排除元素的class, 默认空''
}],

/*
['thirdparty-search', { // 可以添加第三方搜索链接的搜索框(原官方搜索框的参数仍可用)
thirdparty: [ // 可选,默认 []
{
title: '在MDN中搜索',
frontUrl: 'https://developer.mozilla.org/zh-CN/search?q=', // 搜索链接的前面部分
behindUrl: '' // 搜索链接的后面部分,可选,默认 ''
},
{
title: '在Bing中搜索',
frontUrl: 'https://cn.bing.com/search?q='
}
]
}],
*/

//全文搜索插件
['fulltext-search'],
//sitemap 插件
['sitemap',{
hostname: 'https://note.oddfar.com'
}],



// 'vuepress-plugin-baidu-autopush', // 百度自动推送

['one-click-copy', { // 代码块复制按钮
copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
duration: 1000, // prompt message display time.
showInMobile: false // whether to display on the mobile side, default: false.
}],
['demo-block', { // demo演示模块 https://github.com/xiguaxigua/vuepress-plugin-demo-block
settings: {
// jsLib: ['http://xxx'], // 在线示例(jsfiddle, codepen)中的js依赖
// cssLib: ['http://xxx'], // 在线示例中的css依赖
// vue: 'https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js', // 在线示例中的vue依赖
jsfiddle: false, // 是否显示 jsfiddle 链接
codepen: true, // 是否显示 codepen 链接
horizontal: false // 是否展示为横向样式
}
}],
[
'vuepress-plugin-zooming', // 放大图片
{
selector: '.theme-vdoing-content img:not(.no-zoom)', // 排除class是no-zoom的图片
options: {
bgColor: 'rgba(0,0,0,0.6)'
},
},
],

[
'@vuepress/last-updated', // "上次更新"时间格式
{
transformer: (timestamp, lang) => {
const moment = require('moment') // https://momentjs.com/
return moment(timestamp).format('YYYY/MM/DD, H:MM:SS');
}
}
]


]
104 changes: 104 additions & 0 deletions docs/.vuepress/config/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// 此文件没有用到,仅用于测试和侧边栏数据格式的参考。

module.exports = { // 侧边栏
'/01.前端/': [
{
title: 'JavaScript',
collapsable: false, //是否可折叠,可选的,默认true
children: [
['01.JavaScript/01.JavaScript中的名词概念','JavaScript中的名词概念'],
['01.JavaScript/02.数据类型转换','数据类型转换'],
['01.JavaScript/03.ES5面向对象','ES5面向对象'],
['01.JavaScript/04.ES6面向对象','ES6面向对象'],
['01.JavaScript/05.new命令原理','new命令原理'],
['01.JavaScript/06.多种数组去重性能对比','多种数组去重性能对比'],
]
},
],
'/02.页面/': [
{
title: 'html-css',
collapsable: false,
children: [
['01.html-css/00.flex布局语法','flex布局语法'],
['01.html-css/01.flex布局案例-基础','flex布局案例-基础'],
['01.html-css/02.flex布局案例-骰子','flex布局案例-骰子'],
['01.html-css/03.flex布局案例-网格布局','flex布局案例-网格布局'],
['01.html-css/04.flex布局案例-圣杯布局','flex布局案例-圣杯布局'],
['01.html-css/05.flex布局案例-输入框布局','flex布局案例-输入框布局'],
['01.html-css/06.CSS3之transform过渡','CSS3之transform过渡'],
['01.html-css/07.CSS3之animation动画','CSS3之animation动画'],
]
},
],
'/03.技术杂谈/': [
{
title: '技术杂谈',
collapsable: false, //是否可折叠,可选的,默认true
sidebarDepth: 2, // 深度,可选的, 默认值是 1
children: [
['01.Git使用手册','Git使用手册'], // 同 {path: '01.Git使用手册', title: 'Git使用文档'}
['02.GitHub高级搜索技巧','GitHub高级搜索技巧'],
['03.Markdown使用教程','Markdown使用教程'],
['04.npm常用命令','npm常用命令'],
['05.yaml语言教程','yaml语言教程'],
['06.解决百度无法收录搭建在GitHub上的个人博客的问题','解决百度无法收录搭建在GitHub上的个人博客的问题'],
['07.使用Gitalk实现静态博客无后台评论系统','使用Gitalk实现静态博客无后台评论系统'],
]
}
],
'/04.其他/': [
{
title: '学习',
collapsable: false,
children: [
['01.学习/01.学习网站','学习网站'],
['01.学习/02.学习效率低,忘性很大怎么办?','学习效率低,忘性很大怎么办?'],
]
},
{
title: '学习笔记',
collapsable: false,
children: [
['02.学习笔记/01.小程序笔记','小程序笔记'],
]
},
{
title: '面试',
collapsable: false, //是否可折叠,可选的,默认true
children: [
['03.面试/01.面试问题集锦','面试问题集锦'],
]
},
['01.在线工具','在线工具'],
['02.友情链接','友情链接'],
],
// '/': [ // 在最后定义,在没有单独设置侧边栏时统一使用这个侧边栏
// '',
// 'git',
// 'github',
// 'markdown',
// 'study',
// 'interview'
// // '/',
// // {
// // title: 'foo', // 标题,必要的
// // path: '/foo/', // 标题的路径,可选的, 应该是一个绝对路径
// // collapsable: false, // 是否可折叠,可选的,默认true
// // sidebarDepth: 1, // 深度,可选的, 默认值是 1
// // children: [
// // ['foo/', '子页1'],
// // 'foo/1',
// // 'foo/2',
// // ]
// // },
// // {
// // title: 'bar',
// // children: [
// // ['bar/', '子页2'],
// // 'bar/3',
// // 'bar/4',
// // ]
// // }
// ],
}
Loading

0 comments on commit c08d6be

Please sign in to comment.