需求
-
Hexo的痛点之一,需要配置本地环境,并且有很大几率报错,还要debug,尤其在非常用电脑上更新实在不便
-
本地环境的性能,不一定比GitHub主机强
-
需要优雅的简化更新过程
解决
- 新建私有仓库
- clone到本地
- 本地上传hexo所有代码
- 配置actions
name: hexo_deploy
on:
push:
branches: [ "main" ]
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: use Node 18
uses: actions/setup-node@v1
with:
node-version: 18
- name: npm install
run: |
npm install -g hexo-cli
npm install
env:
CI: true
- name: hexo build
run: |
hexo clean
hexo generate
env:
CI: true
- name: douban
run: |
hexo douban
env:
CI: true
- name: Deploy
run: |
git config --global user.name "用户名"
git config --global user.email "注册邮箱"
hexo deploy
- 配置git推送
deploy:
type: git
repository:
github: https://[token]/[用户名]/[仓库名].git,main