### 使用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就可以了
- 【入門】1:Hugo介紹
- 【入門】2:Hugo網站和主題演示
- 【入門】3:Hugo跟Wordpress和Hexo對比
- 【入門】4:20分鐘快速搭建Hugo網站
- 【入門】5:免費網站托管到Gitpages
- 【入門】6:圖標icon/robot.txt/404頁面創建和設置
- 【入門】7:網站地圖sitemap
- 【進階】8:自定義菜單
- 【進階】9:自定義Tag/category
- 【進階】10:頁面Meta keyword
- 【進階】12:創建頁面摘要
- 【進階】11:創建列表【進行中...】
- 【進階】13:創建分頁
- 【進階】14:創建統計
- 【進階】15:創建rss
- 【高級】16:創建頁面目錄
- 【高級】17:創建站內搜索
- 【高級】18:創建多語言支持
- 【高級】19:顯示相關內容
- 【高級】20:顯示當前頁面所有Tag
- 【高級】21:創建社交聯系方式
- 【高級】22:創建社交分享
- 【高級】23:創建評論gitalk
- 【高級】24:自動化部署-netlify
- 【高級】25:自動化部署-Github actions