惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
Hacker News: Ask HN
Hacker News: Ask HN
Know Your Adversary
Know Your Adversary
C
Cisco Blogs
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
T
Tor Project blog
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
腾讯CDC
L
LangChain Blog
IT之家
IT之家
Recent Commits to openclaw:main
Recent Commits to openclaw:main
月光博客
月光博客
N
News and Events Feed by Topic
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Tailwind CSS Blog
Jina AI
Jina AI
S
Security Affairs
T
The Blog of Author Tim Ferriss
博客园 - Franky
H
Hacker News: Front Page
Martin Fowler
Martin Fowler
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
Webroot Blog
Webroot Blog
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
U
Unit 42
S
Schneier on Security
B
Blog
Schneier on Security
Schneier on Security
Latest news
Latest news
TaoSecurity Blog
TaoSecurity Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
Recorded Future
Recorded Future
O
OpenAI News
雷峰网
雷峰网
H
Heimdal Security Blog

Mycpen

13_Hexo-操作记录 12_Hexo-GitHub Actions 发布博客静态资源至 NPM 06_转载-自我提升的8个好习惯 05_转载-延寿指南-反向面试-文档写作规范 04_转载-提问的智慧 03_转载-中文文案排版指北 10_Hexo-GitHub Actions 自动刷新多吉云 CDN 缓存 08_Other-GitHub Actions 定时执行脚本,备份又拍云云存储 07_Other-文章记录-sshpass 03_Error-问题记录-winpty-.gitignore 02_转载-Replit 部署 Memos & Butterfly 基于 Memos 实现清单功能 09_Hexo-Replit 搭建 Uptime Kuma 监控服务 08_Hexo-博客引用 B站鸿蒙字体 07_Hexo-插件整理 06_Other-Windows 图片批量压缩工具 ultra-tinypng 01_转载-图床搭建 Backblaze B2 + Cloudflare CDN 05_Other-使用 Python open 函数批量替换文件内容 04_Other-使用 Python ftplib 模块同步又拍云云存储数据至本地 03_Other-PC端环境记录
11_Hexo-GitHub Actions 自动部署博客
Mycpen · 2023-04-04 · via Mycpen

简单记录,步骤潦草

示例

1. .gitignore

根路径 .gitignore 内容

1
2
3
4
5
6
7
8
9
10
11
.DS_Store
#/Thumbs.db
/db.json
*.log
node_modules/
public/
.deploy*/
.deploy_git/
.deploy_git*/
.idea
themes/butterfly/.git

2. workflows

根路径 .github/workflows/autodeploy.yml 内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Auto deploy

on:
workflow_dispatch:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 检查分支
uses: actions/checkout@v2
with:
ref: main

- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Asia/Shanghai"

- name: 安装 Node
uses: actions/setup-node@v1
with:
node-version: "18.x"

- name: 安装 Hexo
run: |
export TZ='Asia/Shanghai'
npm install hexo-cli -g

- name: 缓存 Hexo
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}

- name: 安装依赖
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install gulp-cli -g #全局安装gulp
npm install --save

- name: Generate static file
run: |
hexo clean ; hexo generate ; gulp

- name: 推送百度 url
run: |
hexo deploy

- name: Deploy static file
run: |
cd ./public
git init
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global user.name 'github-actions[bot]'
git add .
git commit -m "$(date +'%Y/%m/%d')"
git push --force --quiet "https://mycpen:${{ secrets.GH_TOKEN }}@github.com/mycpen/blog.git" master:main

- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 6

Actions Secrets 变量含义

Secrets 变量释义
GH_TOKENGitHub Token

3. 插件

hexo-baidu-url-submit:https://github.com/huiwang/hexo-baidu-url-submit

根路径 _config.yml 配置文件

1
2
3
4
5
6
7
8
9
10
11
12


deploy:
- type: baidu_url_submitter



baidu_url_submit:
count: 1000
host: blog.xxx.com
token: xxxxxx
path: baidu_urls.txt

参考

  1. Akilar | 使用Github Action实现全自动部署

  2. 安知鱼 | hexo博客工作流CI(一键部署的快乐)

  3. CCKNBC | 工作流示例

  4. https://github.com/Mattraks/delete-workflow-runs

  5. https://github.com/dmego/home.github.io/blob/gh-pages/.github/workflows/auto-bing.yml

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议,转载请注明来自 Mycpen


欢迎访问 MYCPEN BLOG

建站初衷 记录学习历程,整理平时发现并解决的问题