Add ACCESS_TOKEN

按照🍎VuePress+GitHub Actions教程里的先配置好ACCESS_TOKEN

Add Blog CLI

接下来开始配置我们需要的 actions

  1. name: Chara自用actions
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. build-and-deploy:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: 版本检出
  11. uses: actions/checkout@v1
  12. - name: 安装node
  13. uses: actions/setup-node@v1
  14. - name: 安装hexo
  15. run: |
  16. npm install
  17. npm install hexo -g
  18. - name: 完成配置
  19. env:
  20. ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
  21. run: |
  22. git config --global user.name "KongValley"
  23. git config --global user.email "kzp13968320676@163.com"
  24. sed -i "s/github_token/${ACCESS_TOKEN}/g" ./_config.yml
  25. # 将github_token字符串替换成我们配置好的ACCESS_TOKEN
  26. # _config.yml 中配置的仓库地址 https://KongValley:github_token@github.com/KongValley/KongValley.github.io.git
  27. - name: 代码提交到主仓库
  28. run: |
  29. hexo clean
  30. hexo g
  31. hexo d

配置完 push 即可