Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shenweiyan committed Jan 21, 2025
0 parents commit 15a15c1
Show file tree
Hide file tree
Showing 418 changed files with 49,071 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: 私人博客,请勿私自发起 Issue
about: 这并不是回复 Issue 的按钮。
title: "私人博客,请勿私自发起 Issue"
labels: 'spam'
assignees: ''

---

**请注意:这是一个私人博客,请不要在这里练习新建 Issue,你的每一条回复,都会导致本仓库的 watcher 收到邮件,请慎用。**

**如果恶意发布 Issue,将会加入 GitHub 黑名单。**
26 changes: 26 additions & 0 deletions .github/workflows/deploy-gh-pages.yml.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy docs To GitHub Pages
on:
workflow_run:
workflows: Aync-Yuque-Docs # 需要监听的流程名字
types: completed

permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs gh-deploy --force

67 changes: 67 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: mkdocs-deploy

on:
push:
branches:
- main
schedule:
- cron: '0 19 * * *'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 检查分支
uses: actions/checkout@v4

- name: Git config
run: |
git config --global user.name "shenweiyan"
git config --global user.email "[email protected]"
- name: Git Pull
run: git pull

- name: Install Python3
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install requirements
run: pip3 install requests python-slugify pytz PyYaml

- name: Get All Discussions
run: python3 script/getAllDiscussions.py -r shenweiyan/Knowledge-Garden -t ${{ secrets.PERSONAL_ACCESS_TOKEN }} -o docs/Discussions.txt

- name: Generate blog posts
run: python3 script/discussions2blog.py -i docs/Discussions.txt

- name: Generate mkdocs posts
run: python3 script/discussions2mkdocs.py -i docs/Discussions.txt -c nav4dir.yml

- name: Generate mkdocs special pages
run: python3 script/discussions4pages.py -i docs/Discussions.txt

- name: Commit files
run: |
current="`TZ=UTC-8 date +'%Y-%m-%d %H:%M:%S'`"
message="Add Changes By GitHub Actions: $current (CST/UTC-8)"
echo "$message" > update.log
git add --all
git commit -a -m "$message"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
branch: main

- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs gh-deploy --force
73 changes: 73 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: code-sync

on:
workflow_run:
workflows: mkdocs-deploy
types: completed

jobs:
push-to-mirror:
runs-on: ubuntu-latest
steps:
- name: Clone
run: |
git config --global init.defaultBranch main
git init
git remote add origin https://shenweiyan:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git fetch --all
for branch in `git branch -a | grep remotes | grep -v HEAD`; do
git branch --track ${branch##*/} $branch
done
env:
GITHUB_REPOSITORY: shenweiyan/Knowledge-Garden
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Push to AtomGit Knowledge-Garden
run: |
remote_repo="https://weiyan:${ATOMGIT_PAT}@atomgit.com/${ATOMGIT_REPOSITORY}.git"
git remote add atomgit "${remote_repo}"
git show-ref
git branch --verbose
# publish all
git push --all --force atomgit
git push --tags --force atomgit
env:
ATOMGIT_REPOSITORY: weiyan/Knowledge-Garden
ATOMGIT_PAT: ${{ secrets.ATOM_PAT }}

- name: Push to Gitcode Knowledge-Garden
run: |
remote_repo="https://shenweiyan:${GITCODE_PASSWORD}@gitcode.com/${GITCODE_REPOSITORY}.git"
git remote add gitcode "${remote_repo}"
git show-ref
git branch --verbose
# publish all
git push --all --force gitcode
git push --tags --force gitcode
env:
GITCODE_REPOSITORY: shenweiyan/Knowledge-Garden
GITCODE_PASSWORD: ${{ secrets.GITCODE_PAT }}

- name: Push to Gitee shenweiyan
uses: Yikun/hub-mirror-action@master
with:
src: github/shenweiyan
dst: gitee/shenweiyan
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "Knowledge-Garden"
mappings: "Knowledge-Garden=>shenweiyan"
force_update: true
timeout: '0.5h'

#- name: Build Gitee Pages
# uses: yanglbme/gitee-pages-action@main
# with:
# 注意替换为你的 Gitee 用户名
#gitee-username: shenweiyan
# 注意在 Settings->Secrets 配置 GITEE_PASSWORD
#gitee-password: ${{ secrets.GITEE_PASSWORD }}
# 注意替换为你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错
#gitee-repo: shenweiyan/shenweiyan
# 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在)
#branch: gh-pages
100 changes: 100 additions & 0 deletions .github/workflows/yuque-mkdocs.yml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Aync-Yuque-Mkdocs-Pages

on:
# 允许手动push触发
push:
branches:
- main
# 允许外部仓库事件触发
repository_dispatch:
types:
- deploy

jobs:
build:
runs-on: ubuntu-latest
#env:
#ENABLE_YUQUE: ${{ secrets.ENABLE_YUQUE }}

steps:
- name: 检查分支
uses: actions/checkout@master

- name: 安装node环境
uses: actions/setup-node@master
with:
node-version: "16.x"

- name: 安装pnpm
run: |
export TZ='Asia/Shanghai'
npm install [email protected] -g

- name: 安装依赖
run: |
export TZ='Asia/Shanghai'
pnpm install --prod

- name: 清除缓存
env:
CLEAN_CACHE: ${{ secrets.CLEAN_CACHE }}
if: ${{ env.CLEAN_CACHE == 'true' }}
run: |
pnpm clean:yuque
#pnpm clean:notion
#pnpm clean:flowus

- name: 拉取语雀&Notion&FlowUs的文章
env:
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }}
YUQUE_LOGIN: ${{ secrets.YUQUE_LOGIN }}
YUQUE_REPO: ${{ secrets.YUQUE_REPO }}
#NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
#NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
COS_IMAGE_BUCKET: ${{ secrets.COS_IMAGE_BUCKET }}
COS_IMAGE_REGION: ${{ secrets.COS_IMAGE_REGION }}
#FLOWUS_TABLE_PAGE_ID: ${{ secrets.FLOWUS_TABLE_PAGE_ID }}
run: |
#pnpm sync:flowus
pnpm sync:yuque
#pnpm sync:notion

- name: 配置Git用户名邮箱
run: |
git config --global user.name "shenweiyan"
git config --global user.email "[email protected]"

- name: 安装Python3
uses: actions/setup-python@main
with:
python-version: 3.9

- name: Generate index.md
run: python makeindex.py -r -d docs/cookbook

- name: 提交yuque拉取的文章到GitHub仓库
run: |
echo `date +"%Y-%m-%d %H:%M:%S"` begin ... > time.txt
git add .
git commit -m "Refresh elog.cache.json" -a

- name: 推送文章到仓库
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs gh-deploy --force
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 维燕的知识花园

这是一个 **All in [GitHub Discussions](https://github.com/shenweiyan/Knowledge-Garden/discussions)** 的知识库,没事在 GitHub 写写文章,喜欢的话请点 Star,想订阅点 Watch。

- 在 GitHub 订阅 Discussions
![订阅 GitHub Discussions](https://shub.weiyan.tech/website/watch-github-discussions.png)

- 从 RSS 订阅 Discussions
<https://github.com/shenweiyan/Knowledge-Garden/discussions.atom>

## 特别说明

很长一段时间以来,一直都在使用语雀来记录个人工作生活的各种知识。

最近一段时间 (2023.07) 由于某些原因,开始考虑数据多平台使用+备份+搜索的一些使用场景,几经考虑于是决定开始 All in GitHub 的一些探索,把语雀的一些文章记录同步到这里。同时开始使用 GitHub Discussions 全面替代小记+写作。

## 感谢

本仓库的 cookbook/notebook 等文档都是基于 [https://github.com/LetTTGACO/elog](https://github.com/LetTTGACO/elog) 实现的同步与备份。

## 最后
不断迭代中,如果有帮助欢迎点个激励的⭐️
Loading

0 comments on commit 15a15c1

Please sign in to comment.