Skip to content

Instantly share code, notes, and snippets.

@TransformersWsz
Last active February 29, 2024 08:58
Show Gist options
  • Save TransformersWsz/1bd68b6c6cc25a1ccf50fc9f12faa1a1 to your computer and use it in GitHub Desktop.
Save TransformersWsz/1bd68b6c6cc25a1ccf50fc9f12faa1a1 to your computer and use it in GitHub Desktop.
hexo blog ci github action
# workflow name
name: Hexo Blog CI
# master branch on push, auto run
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# check it to your workflow can access it
# from: https://github.com/actions/checkout
- name: Checkout Repository master branch
uses: actions/checkout@master
# from: https://github.com/actions/setup-node
- name: Setup Node.js 16.x
uses: actions/setup-node@master
with:
node-version: "16.14.0"
- name: Cache node modules
uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Hexo Dependencies
run: |
npm install hexo-cli -g
npm install
- name: update mathjax
run: |
cp correct/hexo-renderer-kramed/renderer.js node_modules/hexo-renderer-kramed/lib/
cp correct/kramed/inline.js node_modules/kramed/lib/rules/
cp correct/hexo-renderer-mathjax/mathjax.html node_modules/hexo-renderer-mathjax
cp correct/hexo-tag-echarts/echarts-template.html node_modules/hexo-tag-echarts
cp correct/hexo-asset/index.js node_modules/hexo-asset/lib/
- name: Setup Deploy Private Key
env:
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRI }}
run: |
mkdir -p ~/.ssh/
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Setup Git Infomation
run: |
git config --global user.name "TransformersWsz"
git config --global user.email "3287124026@qq.com"
- name: Deploy Hexo
run: |
hexo clean
hexo generate
hexo deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment