GithubAction-Deploy

githubhexoaction

使用 github action 自动化部署

创建GitHub repository 存放源文件

在repo设置界面里添加Secrets(本地生成一对公私钥ssh-keygen,这里填上私钥,命名为 ACTION_DEPLOY_KEY(可以任意命名,但要和Actions里的设定$对应)

在存放GitHub pages的repo设定Deploy keys为刚生成的公钥

在根目录下创建GitHub Actions workflow文件

name: Build and Update Note.junyangz.com for github pages
on: push
jobs:
build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: "10.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" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
# set git infomation
git config --global user.name 'Junyangz'
git config --global user.email 'junyangz.iie@gmail.com'
# install dependencies
npm i -g hexo-cli
npm i
- name: Deploy
run: |
# generate and depoly
hexo g -d

参考链接

  1. GitHub Actions部署Hexo博客
  2. 通过Github Actions自动部署Hexo

最新文章

  1. 如何监控ORACLE索引使用与否
  2. Linux软件安装为什么名字不一样
  3. mysql配置之skip-external-locking
  4. 用Unity开发HTC VIVE——手柄控制篇
  5. Camera中对焦模式总结
  6. 学习Visitor Pattern 有感而发!override and overload
  7. windows下Nginx配置与测试
  8. 将多个Sheet导入到同一个Excel文件中
  9. Oracle分区表学习
  10. hadoop namespace
  11. LPC1788的内部EEPROM使用
  12. java中集合框架
  13. 在iview的Table中添加Select(render)
  14. Flask的session使用
  15. ansible的plugins
  16. 使用TensorFlow训练模型的基本流程【转】
  17. python 操作数据库
  18. Difference between plt.draw() and plt.show() in matplotlib
  19. Mac下用zsh
  20. go语言功能代码

热门文章

  1. FCOS : 找到诀窍了,anchor-free的one-stage目标检测算法也可以很准 | ICCV 2019
  2. A 拜访奶牛
  3. PHP获取所有扩展及扩展下的所有函数签名生成php.snippet
  4. 怎么用scratch做大鱼吃小鱼
  5. Hadoop(一)基本简介
  6. Vulnhub DC-7靶机渗透
  7. C++ stringstream(强制类型转换)
  8. "二号标题"组件:<h2> —— 快应用组件库H-UI
  9. Linux Mint(Ubuntu)如何管理开机自动启动项?
  10. Byte字节