### 使用github actions部署 - github actions 实际就是一个ci/cd工具,github官方介绍:GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.https://github.com/features/actions 1. 选择你的repository:https://github.com/clouda3/gohugo.me , 选择actions 2. setup workflow 3. 右侧marketplace,搜索hugo 4. 选择对应的workflow 5. 来创建.github/workflows/main.yml ``` name: github pages on: push: branches: - master jobs: build-deploy: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 # with: # submodules: true - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: hugo-version: '0.59.1' # extended: true - name: Build run: hugo --minify - name: Deploy uses: clouda3/actions-gh-pages@master env: GITHUB_ANOTHER_REPOSITORY: clouda3/clouda3.github.io PERSONAL_TOKEN: xxxxx PUBLISH_BRANCH: master PUBLISH_DIR: ./public ``` 1. deploy uses选择自己的脚本,这个是从actions-gh-pages branch出来的,因为他不支持deploy到另外一个repository里面,所以我做了修改了,允许将生成完毕的html代码发布到另外一个repository里面 2. 执行了actions之后检查clouda3/clouda3.github.io里面代码发生了更新 - 总结 3. 使用actions做ci/cd之后,我们只需要push我们的md文件就可以了,也就是说基本上我们把他当作一个cms就可以了