Commit 0645d41f authored by CC康纳百川's avatar CC康纳百川 🎯
Browse files

Update posts content

parents
name: Baidu Sitemap Push
on:
schedule:
- cron: '0 16 * * *'
workflow_dispatch:
inputs:
name:
description: '手动触发推送'
required: false
jobs:
build:
name: Baidu Sitemap Push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Set Up Python
uses: actions/setup-python@main
with:
python-version: 3.9
- name: Install Requests
run: pip install requests
- name: Generate Txt
run: python generate.py
- name: Baidu Push
run: curl -H 'Content-Type:text/plain' --data-binary @urls.txt "${{ secrets.BAIDU_TOKEN }}"
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 1
- name: Telegram Notification
if: cancelled() == false
uses: xinthink/action-telegram@v1.1
with:
botToken: ${{ secrets.TG_BOT_TOKEN }} #use bot @BotFather
chatId: ${{ secrets.TG_CHAT_ID }} #use bot @userinfobot
jobStatus: ${{ job.status }}
skipSuccess: true
\ No newline at end of file
name: Deploy Hexo Public To Pages
on:
repository_dispatch:
workflow_dispatch:
push:
branches: master
jobs:
deploy:
name: Deploy Hexo Public To Pages
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@main
with:
ref: master
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@main
with:
node-version: "16.x"
- name: Catch
uses: actions/cache@main
id: cache-dependencies
with:
path: node_modules
key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}
- name: Install Dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
npm install
# - name: Generate
# run: |
# npm run github
- name: Generate
run: |
npm run github-yuque
- name: Deploy Markdown Posts To Branch Posts
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: posts
publish_dir: ./source/_posts
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
full_commit_message: ${{ github.event.head_commit.message }}
- name: Deploy Hexo Public To Pages
run: |
cd ./public
git config --global init.defaultBranch master
git config --global http.postBuffer 524288000
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git init
git add -A
git branch -m master
git commit -m "${{ github.event.head_commit.message }} $(date +"%Z %Y-%m-%d %A %H:%M:%S") Updated By Github Actions"
git push --force --quiet "https://ccknbc:${{ secrets.GH_TOKEN }}@github.com/CCKNBC/ccknbc.github.io.git" master:master
git push --force --quiet "https://ccknbc:${{ secrets.BB_TOKEN }}@bitbucket.org/ccknbc/ccknbc.bitbucket.io.git" master:master
git push --force --quiet "https://${{ secrets.CD_USER }}:${{ secrets.CD_TOKEN }}@e.coding.net/ccknbc/blog/butterfly.git" master:master
git push --force --quiet "https://ccknbc:${{ secrets.GT_TOKEN }}@gitee.com/ccknbc/ccknbc.git" master:master
# - name: Update Gitee Pages
# uses: yanglbme/gitee-pages-action@main
# with:
# gitee-username: ccknbc
# gitee-password: ${{ secrets.GITEE_PASSWORD }}
# gitee-repo: ccknbc/ccknbc
- name: Purge JsDelivr CDN
run: |
curl https://purge.jsdelivr.net/gh/CCKNBC/ccknbc.github.io/
curl https://purge.jsdelivr.net/gh/CCKNBC/ccknbc.github.io/css/index.css
curl https://purge.jsdelivr.net/gh/CCKNBC/ccknbc.github.io/js/main.js
curl https://purge.jsdelivr.net/gh/CCKNBC/ccknbc.github.io/js/utils.js
- name: Sync RSS
run: |
curl 'https://kkapi.vercel.app/api/github?type=dispatch&owner=ccknbc-actions&repo=home&token=${{ secrets.GH_TOKEN }}&runit_text=RSS'
curl -X POST -F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} -F ref=master https://gitlab.com/api/v4/projects/22130436/trigger/pipeline
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 1
- name: Telegram Notification
if: cancelled() == false
uses: xinthink/action-telegram@v1.1
with:
botToken: ${{ secrets.TG_BOT_TOKEN }}
chatId: ${{ secrets.TG_CHAT_ID }}
jobStatus: ${{ job.status }}
skipSuccess: false
.DS_Store
Thumbs.db
db.json
yuque.json
*.log
public
node_modules
.deploy*
.nojekyll
source/_posts/语雀
themes/butterfly/.git
\ No newline at end of file
image: node:latest
variable:
script:
- echo $YUQUE_TOKEN
pages:
script:
- npm install
- npm run gitlab-yuque
artifacts:
paths:
- public
cache:
paths:
- node_modules
key: project
only:
- master
pull_request_rules:
- name: automatic merge for Renovate pull requests
conditions:
- author=renovate[bot]
actions:
merge:
method: merge
- name: automatic merge for Github Actions pull requests
conditions:
- author=github-actions[bot]
actions:
merge:
method: merge
- name: automatic merge for Snyk pull requests
conditions:
- author=snyk-bot
actions:
merge:
method: merge
- name: automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
actions:
merge:
method: merge
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
title: CC的部落格
subtitle: CC康纳百川
description: CC的部落格,CC康纳百川的小窝,与你分享二三事
keywords: CC的部落格,CC康纳百川,ccknbc,blog
author: CC康纳百川
email: blog@ccknbc.cc
language: zh-CN
timezone: Asia/Shanghai
url: https://blog.ccknbc.cc
root: /
permalink: posts/:translate_title/
permalink_defaults:
pretty_urls:
trailing_index: false
trailing_html: false
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
new_post_name: :title.md
default_layout: post
auto_spacing: true
titlecase: false
external_link:
enable: true
field: site
exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
auto_detect: false
line_number: false
tab_replace: ''
wrap: true
hljs: false
prismjs:
enable: false
preprocess: true
line_number: true
tab_replace: ''
marked:
gfm: true
pedantic: false
breaks: true
smartLists: true
smartypants: true
quotes: '“”‘’'
modifyAnchors: 0
anchorAlias: true
autolink: true
mangle: true
sanitizeUrl: false
headerIds: true
lazyload: true
prependRoot: false
postAsset: false
external_link:
enable: true
exclude: [www.ccknbc.cc,ccknbc.cc]
nofollow: true
disableNunjucks: false
descriptionLists: true
stylus:
compress: true
sourcemaps:
comment: true
inline: true
sourceRoot: ''
basePath: .
plugins: 'nib'
index_generator:
path: ''
per_page: 10
order_by: -date
default_category:
category_map:
tag_map:
meta_generator: true
date_format: YYYY-MM-DD
time_format: HH:mm:ss
updated_option: 'mtime'
per_page: 0
pagination_dir: page
include:
exclude:
ignore:
theme: butterfly
feed:
enable: true
type:
- atom
- rss2
path:
- atom.xml
- rss.xml
limit: 5
hub:
content: true
content_limit: false
content_limit_delim: ' '
order_by: -updated
icon: https://cdn.jsdelivr.net/gh/ccknbc-backup/cdn/logo/logo.png
autodiscovery: true
template:
- ./source/_data/atom.xml
- ./source/_data/rss.xml
sitemap:
path: sitemap.xml
template:
rel: true
tags: false
categories: false
translate_title:
translate_way: google
youdao_api_key: ''
youdao_keyfrom: xxxx-blog
is_need_proxy: false
proxy_url: http://localhost:8080
baidu_appid: ''
baidu_appkey: ''
rewrite: false
use_webp: false
plugins:
- hexo-algoliasearch
algolia:
appId: "947RX7HP3E"
applicationID: "947RX7HP3E"
apiKey: "9114b3fa2a3307b2cc8eec7e3ae5a8ea"
chunkSize: 5000
indexName: "ccknbc-blog"
fields:
- path
- title
- content:strip
nofollow:
enable: true
field: site
exclude:
- 'ccknbc.com'
- 'www.ccknbc.com'
archive_generator:
enabled: true
per_page: 0
yearly: false
monthly: false
daily: false
order_by: -date
category_generator:
per_page: 0
order_by: -date
tag_generator:
per_page: 0
order_by: -date
webPushNotification:
webpushrKey: "19e7fc04388c7dd68a5926d7326f3bea"
webpushrAuthToken: "16778"
trackingCode: "BB9Y-w9p3u0CKA7UP9nupB6I-_NqE2MuODmKJjyC4W2YflX06Ff_hEhrNJfonrut5l6gCa28gC83q2OII7Qv-oA"
memorial_day:
enable: false
day: 2021-05-22
douban:
user: CCKNBC
builtin: true
book:
title: 'This is my book title'
quote: 'This is my book quote'
meta: true
comments: true
top_img: false
aside: false
path: books
movie:
title: '我看过的影视'
quote: '我看过的影视'
meta: true
comments: true
top_img: false
aside: false
path: movies
# game:
# title: 'This is my game title'
# quote: 'This is my game quote'
# meta: true
# comments: true
# top_img: false
# aside: false
# path: games
timeout: 10000
# tag-plugins-plus
# see https://akilar.top/posts/615e2dec/
tag_plugins:
enable: true # 开关
priority: 5 #过滤器优先权
issues: false #issues标签依赖注入开关
CDN:
anima: https://cdn.jsdelivr.net/gh/l-lin/font-awesome-animation/dist/font-awesome-animation.min.css #动画标签anima的依赖
jquery: false #https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js #issues标签依赖
issues: false #https://cdn.jsdelivr.net/npm/hexo-theme-volantis@latest/source/js/issues.min.js #issues标签依赖
iconfont: false #//at.alicdn.com/t/font_2032782_8d5kxvn09md.js #参看https://akilar.top/posts/d2ebecef/
wowjs:
enable: true #控制动画开关。true是打开,false是关闭
priority: 10 #过滤器优先级
mobile: false #移动端是否启用,默认移动端禁用
animateitem:
- class: recent-post-item #必填项,需要添加动画的元素的class
style: animate__zoomIn #必填项,需要添加的动画
duration: 2s #选填项,动画持续时间,单位可以是ms也可以是s。例如3s,700ms。
delay: 1s #选填项,动画开始的延迟时间,单位可以是ms也可以是s。例如3s,700ms。
offset: 100 #选填项,开始动画的距离(相对浏览器底部)
iteration: 2 #选填项,动画重复的次数
- class: card-widget
style: animate__zoomIn
\ No newline at end of file
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = git@github.com:ccknbc-actions/blog-butterfly.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@gitlab.com:ccknbc/ccknbc.gitlab.io.git
url = git@bitbucket.org:ccknbc/blog.git
url = git@e.coding.net:ccknbc/blog/blog-butterfly.git
url = git@gitee.com:ccknbc/blog-butterfly.git
[branch "master"]
remote = origin
merge = refs/heads/master
import re
import urllib
import requests
sitemap = 'https://blog.ccknbc.cc/baidusitemap.xml'
html = urllib.request.urlopen(sitemap).read().decode('utf-8')
result = re.findall(re.compile(r'(?<=<loc>).*?(?=</loc>)'), html)
with open('urls.txt', 'w') as file:
for data in result:
print(data, file=file)
file.close()
\ No newline at end of file
const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');
const htmlmin = require('gulp-html-minifier-terser');
const htmlclean = require('gulp-htmlclean');
// const uglify = require('gulp-uglify')
// const babel = require('gulp-babel')
const terser = require('gulp-terser');
const workbox = require("workbox-build");
// gulp.task('compress', () =>
// gulp.src(['./public/**/*.js', '!./public/**/*.min.js'])
// .pipe(babel({
// presets: ['@babel/preset-env']
// }))
// .pipe(uglify().on('error', function (e) {
// console.log(e)
// }))
// .pipe(gulp.dest('./public'))
// )
gulp.task('compress', () =>
gulp.src(['./public/**/*.js', '!./public/**/*.min.js'])
.pipe(terser())
.pipe(gulp.dest('./public'))
)
gulp.task('minify-css', () => {
return gulp.src(['./public/**/*.css'])
.pipe(cleanCSS({
compatibility: 'ie11'
}))
.pipe(gulp.dest('./public'));
});
gulp.task('minify-html', () => {
return gulp.src('./public/**/*.html')
.pipe(htmlclean())
.pipe(htmlmin({
removeComments: true, //清除 HTML 註释
collapseWhitespace: true, //压缩 HTML
collapseBooleanAttributes: true, //省略布尔属性的值 <input checked="true"/> ==> <input />
removeEmptyAttributes: true, //删除所有空格作属性值 <input id="" /> ==> <input />
removeScriptTypeAttributes: true, //删除 <script> 的 type="text/javascript"
removeStyleLinkTypeAttributes: true, //删除 <style> 和 <link> 的 type="text/css"
minifyJS: true, //压缩页面 JS
minifyCSS: true, //压缩页面 CSS
minifyURLs: true
}))
.pipe(gulp.dest('./public'))
});
gulp.task('generate-service-worker', () => {
return workbox.injectManifest({
swSrc: './sw.js',
swDest: './public/sw.js',
globDirectory: './public',
globPatterns: ['index.html'],
modifyURLPrefix: {
'': './'
}
}).then(({count, size, warnings}) => {
//打印错误
warnings.forEach(console.warn);
console.log(`${count} 文件将被预缓存 共占用 ${size/1024} Kb`);
});
});
// 执行 gulp 命令时执行的任务
gulp.task("default",gulp.series("generate-service-worker",gulp.parallel('compress','minify-css', 'minify-html')));
\ No newline at end of file
HexoPath=$(cd "$(dirname "$0")"; pwd)
cd ${HexoPath}
printf "\033[32m Blog 根目录:"${HexoPath}"\033[0m"
echo " "
echo "[0] 退出菜单"
echo "=============以下功能需要在空文件夹内使用================"
echo "[1] 初始化安装 Hexo(仅在第一次安装时使用)"
echo "[2] 从云端恢复 Hexo(需要在脚本中配置仓库 URL)"
echo "=============以下功能需要在 Hexo 文件夹内使用================"
echo "[3] 开启本地预览"
echo "[4] GULP 后开启本地预览"
echo "[5] 开启5000端口本地预览"
echo "[6] 部署页面到博客网站"
echo "[7] 从远程仓库拉取最新版本"
echo "[8] 提交本地修改到远程仓库"
echo "[9] 升级 Hexo 及插件"
echo "[10] 安装 Butterfly 主题"
echo "[11] 升级 Butterfly 主题"
echo "=============以下功能为全局指令================"
echo "[12] 安装ssh密钥"
echo "[13] 验证ssh密钥"
echo " "
printf "请选择需要的功能,默认选择[3] 开启本地预览"
echo " "
printf "选择:"
read answer
if [ "$answer" = "1" ]; then
printf "\033[32mINFO \033[0m 正在为您创建Hexo文件夹 ...\n"
mkdir Hexo
cd Hexo
printf "\033[32mINFO \033[0m 正在将npm源替换为阿里云镜像 ...\n"
npm config set registry https://registry.npm.taobao.org # 替换NPM源为阿里镜像
printf "\033[32mINFO \033[0m 正在为您全局安装Hexo命令集...\n"
npm install -g hexo-cli
printf "\033[32mINFO \033[0m 即将为您开始Hexo初始化安装...\n"
hexo init
printf "\033[32mINFO \033[0m 正在为您安装必要依赖...\n"
npm install --save
npm install hexo-deployer-git --save
printf "\033[32mINFO \033[0m 请查看您当前的Hexo版本...\n"
hexo version
printf "\033[32mINFO \033[0m 安装完成,您可以开始您的Hexo之旅了!\n"
printf "\033[32mINFO \033[0m 请将本脚本文件放入Hexo文件夹以继续使用其他功能!\n"
sleep 5s
printf "\033[32mINFO \033[0m 请将本脚本文件放入Hexo文件夹以继续使用其他功能!\n"
sleep 5s
printf "\033[32mINFO \033[0m 请将本脚本文件放入Hexo文件夹以继续使用其他功能!\n"
sleep 5s
exit 0
else
if [ "$answer" = "2" ]; then
printf "\033[32mINFO \033[0m 正在从Github拉取博客源码 ...\n"
git clone https://github.com/ccknbc-actions/blog-Butterfly.git Blog # 记得替换仓库URL为自己的源码存放仓库
cd Hexo
printf "\033[32mINFO \033[0m 正在将npm源替换为阿里云镜像 ...\n"
npm config set registry https://registry.npm.taobao.org # 替换NPM源为阿里镜像
printf "\033[32mINFO \033[0m Hexo恢复中...\n"
npm install