docs: change #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 自动部署 Hexo | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [12.x] | |
steps: | |
- name: 开始运行 | |
uses: actions/checkout@v1 | |
- name: 设置 Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: 配置 Git 环境 | |
env: | |
ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$ACTION_DEPLOY_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git config --global user.name "wjz" | |
git config --global user.email "1637011263@qq.com" | |
- name: 安装 Hexo CI | |
run: | | |
export TZ='Asia/Shanghai' | |
npm i -g hexo-cli | |
npm i | |
- name: 安装插件 | |
run: | | |
npm i | |
- name: 部署博客 | |
run: | | |
rm -rf .deploy_git | |
hexo g -d | |
rm ~/.ssh/id_rsa |