Blog集成到CI

閑著無聊看了看如何部署

公司内部有 k8s 集群,所以也需要學習如何寫 deploy 脚本.目前服務挂在 Travis CI 上,後續可能會使用自己的機器裝個 Github Runner 啥的…

步驟大致為:

  1. 在 Travis 中登錄,然後選擇需要 watch 的倉庫
  2. 編寫 deploy 文件,需要内部暴露字段的可以在 setting 中添加
  3. 在 github 中拿到 person access token,添加到 Travis

因爲 blog 還不需要 build 和 test 的步驟,所以我的 deploy file 暫時還沒有這些:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
language: node_js
node_js:
- 10 # hexo目前似乎還不支持node 14版本

branches:
only:
- master # 需要監聽的branch

before_install:
- npm install -g hexo-cli

install:
- npm install
- npm install hexo-deployer-git

before_script:
- git config user.name "${username}"
- git config user.email "${email}"
- rm -rf themes/next
- git clone https://github.com/theme-next/hexo-theme-next themes/next
- cp assets/config/_config.yml themes/next/_config.yml # 我將自己的theme config存在assets中
- cp assets/images/avatar.jpg themes/next/source/images/avatar.jpg
- sed -i "s/github_token/${GITHUB_TOKEN}/g" _config.yml

script:
- hexo clean
- hexo generate
- echo "Generation finished."
- hexo deploy

notifications:
email:
- foo@example.com
on_success: change
on_failure: always

October Plan

  • React Hook: 首要完成的目標
  • shell: 不知道能學到什麽程度
  • Linux 命令: 不知道能學到什麽程度
  • 優化之前的 code: 算是屎山了

September Harvest

  • Test Driven Development: 業務需求太多,暫時還是需求開發
  • State Management: 還不熟練
  • Null Value Judgment: 後端新使用的框架,如果字段值為0或者'',返回的 data 裏直接沒這個字段了(XD),所以很多地方都新增了判空處理

Left Questions

  • Mobx 包裹的對象無法 log
  • React Native 難以 debug
  • 移動端難以 testing