前端analysis | 3w & 1h

《Github Action》- 一键push-code,自动构建个人博客站点

2020-01-18

个人博客站点,本人使用是hexo.常规的操作就是本地编辑好,然后手动部署。有了GitHub action,就解决了自动化部署问题。
更多关于手动部署,请查阅 Hexo

GitHub 新建个人博客分支my-blog

假设读者已会,不做赘述。
另外提一句,GitHub针对3人一下,支持新建private 分支哦~,这是我的最爱!!

hexo-blog theme上传

之前theme主题,没有上传,构建失败

配置workflow

大致的意思就是,在代码push,触发构建,构建到xxx.github.io master分支上。

Build and Deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
on: 
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout blog code
uses: actions/checkout@v2.0.0

- name: Build and Deploy
uses: Forest10/hexo-deploy-action-with-cname@v1.0.0
env:
USER_NAME: your name # optional
EMAIL: your email # optional
PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }}
PUBLISH_REPOSITORY: your.github.io # The repository the action should deploy to.
BRANCH: master # The branch the action should deploy to.
PUBLISH_DIR: ./public # The folder the action should deploy.

等待构建



使用支付宝打赏
使用微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏