upgrade 16 #23
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: Deploy Blog | |
on: [push] # 当有新push时运行 | |
jobs: | |
build: # 一项叫做build的任务 | |
runs-on: ubuntu-latest # 在最新版的Ubuntu系统下运行 | |
steps: | |
- name: Checkout # 将仓库内master分支的内容下载到工作目录 | |
uses: actions/checkout@v1 # 脚本来自 https://github.com/actions/checkout | |
with: | |
ref: hexo | |
- name: Use Node.js 16.x # 配置Node环境 | |
uses: actions/setup-node@v1 # 配置脚本来自 https://github.com/actions/setup-node | |
with: | |
node-version: "16.x" | |
- name: Setup Hexo env | |
env: | |
ACTION_DEPLOY_KEY: ${{ secrets.ACTION_DEPLOY_KEY }} | |
run: | | |
# set up private key for deploy | |
mkdir -p ~/.ssh/ | |
echo "$ACTION_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa # 配置秘钥 | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
# set git infomation | |
git config --global user.name 'aircjm' # 换成你自己的邮箱和名字 | |
git config --global user.email '[email protected]' | |
# install dependencies | |
export TZ='Asia/Shanghai' | |
npm i -g hexo-cli # 安装hexo | |
npm i | |
- name: InstallPlugins | |
run: | | |
npm install hexo-renderer-pug --save | |
npm install hexo-renderer-stylus --save | |
npm install hexo-deployer-git --save | |
npm install hexo-generator-search --save | |
npm install hexo-douban --save | |
npm install hexo-generator-feed --save | |
npm install hexo-abbrlink --save | |
npm install hexo-wordcount --save | |
- name: Deploy | |
run: | | |
# publish | |
rm -rf .deploy_git | |
hexo g && hexo douban && hexo deploy # 执行部署程序 | |
rm ~/.ssh/id_rsa |