-
Notifications
You must be signed in to change notification settings - Fork 0
初始設定配置
李俊諭 JYUN-YU LI edited this page Dec 5, 2021
·
8 revisions
配置說明可參考: https://github.com/helaili/jekyll-action
-
GitHub Profile -> Developer settings -> Personal access tokens
- Generate new token
- Note 設定此Token名稱,自己命名可識別名稱。
- 設定Token 效期 -> Expiration
- 如果要一直使用請設定
No expiration
- 如果要一直使用請設定
- Select scopes 設定此Token權限
- Public儲存庫只需要repo區塊裡面三個權限,
repo:status
、repo_deployment
、public_repo
- Private儲存庫,需要勾
repo
。 - 其餘權限如有需要再自行開啟。
- Public儲存庫只需要repo區塊裡面三個權限,
- 設定repository Action Secret
- 在目標儲存庫Settings -> secrets 建立名為
GITHUBTOKEN
secret,並將前面建好GitHub Token設置到此secret。
- 在目標儲存庫Settings -> secrets 建立名為
設定好用到的額外套件配置,在跑Action時,建置環境時會依據此檔案配置安裝所需套件。
-
先在
main
分支設定配置檔 -
配置檔放在專案目錄底下
.github/workflows/
-
針對分支push事件做Build Jekyll site
-
針對分支pull_request事件做Build Jekyll site
-
針對分支pull_request - closed事件做Build Jekyll site 和 Deploy Jekyll site
- github-deployment.yml
- 預設佈版分支目標為
gh-pages
,如果需要更改目標分支,調整target_branch
內容 - 在
jekyll_src
設置使用專案目錄位置 - 在
on
區塊設定針對Pull_request Event - type = closed。 - https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
- https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request
將設定好Yaml檔案在main
分支Push上去,在建立一個自訂分支,並依據以下步驟測試執行
- 建立一個commit並透過自訂分支Push上去
- 回到儲存庫Actions確認由push事件做Build Jekyll site 是否成功執行完畢
- 在自訂分支建立一個pull_request
- 在儲存庫pull_request確認由pull_request事件做Build Jekyll site 是否成功執行完畢
- 將pull_request確認進行merge程序
- 確認pull_request merge 程序完成並已closed
- 回到儲存庫Actions確認由pull_request - closed事件做Build Jekyll site 和 Deploy Jekyll site 是否成功執行完畢
- 如果成功執行完畢,在儲存庫分支會多一個
gh-pages
,此為佈版目標分支