Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
20220904 - SITCON 2022 - 從 0 到 GitHub Actions,以...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ChengHao Yang
September 04, 2022
Technology
99
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20220904 - SITCON 2022 - 從 0 到 GitHub Actions,以 Hexo Blog 為例設計專屬的 CI/CD Pipeline
ChengHao Yang
September 04, 2022
More Decks by ChengHao Yang
See All by ChengHao Yang
20260410 - CNTUG meetup #72 - DiskImage Builder 介紹:以 Kubespray CI 打造 RockyLinux 10 Cloud Image 為例
tico88612
0
180
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
300
20260113 - NKP Tour Taipei 2026 - 雲端原⽣標準的商業價值:從開源中立到企業 AI 轉型之路
tico88612
0
55
20251023 - KubeSummit 2025 - Kubespray and IaC Practice Automating On-Premise Kubernetes Deployment
tico88612
0
230
20251020 - Cathay Open Source Meetup #2 - Cloud Native Ecosystem in Taiwan
tico88612
0
56
20250810 - CNTUG Meetup #69 / COSCUP 2025 - Non-Code Contributions for Beginners: Introduction to the Kubernetes Release Team
tico88612
0
130
20250429 - CNTUG Meetup #67 / DevOps Taiwan Meetup #69 - Deep Dive into Tetragon: Building Runtime Security and Observability with eBPF
tico88612
0
450
20241128 - CNTUG Meetup - Recap: KubeCon + CloudNativeCon North America 2024
tico88612
0
110
20241024 - CNTUG meetup - Kubernetes v1.31 簡單雜談
tico88612
0
160
Other Decks in Technology
See All in Technology
Hatena Engineer Seminar 37 jj1uzh
jj1uzh
0
150
“詰む”前に仕組みを作れ 〜技術の波に溺れないためのキャッチアップ術〜
takasyou
7
4.3k
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
150
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
190
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
230
「軸足」は 固定しなくていい - 熱量と強みで描く、しなやかなキャリアの形
kakehashi
PRO
1
280
AIは、人間らしい仕事の夢を見るか?─ AI時代のtoB/toEプロダクトを再設計する
techtekt
PRO
0
160
Zenoh on Zephyr on LiteX
takasehideki
2
130
初めてのDatabricks勉強会
taka_aki
2
190
技術・能力を向上する原理原則 #きのこセッションa #きのこ2026
bash0c7
0
140
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
AI時代における最適なQA組織の作り方
ymty
3
160
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Facilitating Awesome Meetings
lara
57
7k
Mind Mapping
helmedeiros
PRO
1
260
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
210
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
170
Everyday Curiosity
cassininazir
0
240
Music & Morning Musume
bryan
47
7.2k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.5k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Transcript
主講者 tico88612 從 0 到 GitHub Actions,以 Hexo Blog 為例設計專屬的
CI/CD Pipeline
About me ⚫ 梯口 / 楊承昊 ⚫ Username:tico88612 ⚫ 去花蓮寫論文的碩二生
⚫ 修習高中教育師資學程 ⚫ 科技公司擔任 ITSRE 工讀生 ⚫ 歡迎拿鏡音鈴戳友(O)
P a r t 1 前言&故事
None
None
None
⚫ 有後台管理系統 ⚫ 所見即所得(程式碼 Highlight 較難) ⚫ 有網路狀態下編輯、發佈 CMS 內容管理系統
SSG 靜態生成網站 ⚫ 版型自訂較靈活 ⚫ Markdown(程式碼 Highlight 較簡單) ⚫ 只能在單台電腦上編輯、發佈
P a r t 2 自動化前的準備
貓咪 對這是貓咪,貓的演化可以追溯至新生代第三紀古 新世演化出的肉齒類,肉齒類動物為所有現代食肉 目動物的共同演化祖先。
執行 yarn run build 就會產生靜態網頁
Deploy 『如果你的建置、部署、測試、發佈流程無法 自動化,那它就是不可重複的。』 Image Source: Anne Zhou
P a r t 3 設計 CI/CD
0. Architecture
0. Architecture (cont.) 1. Hexo Source 不要追蹤自動生成的頁面。 2. Hexo Source
如果有用到其他的 Git Repo,請善用 Submodule。 3. CI/CD 是分開的概念: 3.1. CI 持續整合,確定程式碼是可以產生頁面。 3.2. CD 持續部屬,將結果自動推送出去。 4. 保持分支的簡潔,這裡會把產生出來的網頁放到別的 Repo 上。
1. 準備 Deploy Key 要準備 deploy key 就要用 ssh-keygen 生成公鑰私鑰
ssh-keygen -t ed25519 -C "<YOUR_EMAIL>" -f deploy <YOUR_EMAIL> 可以替換成你的 GitHub Email 或者照下面填寫 GitHub Actions Bot 的 Email。 ssh-keygen -t ed25519 -C "41898282+github-actions[bot]@users.noreply.github.com" -f deploy 之後就會生成 deploy.pub 跟 deploy 兩個檔案。
Deploy Key deploy.pub 公鑰 deploy 私鑰
2. Hexo Source 專案中放上私鑰 Secret 名稱要記得 Actions 會使用到
3. GitHub Pages 專案中放上公鑰 記得要打勾 write access 這樣 Actions 才能自動推送
4. 設定 GitHub Actions CI 我們可以回想一下我們要怎麼設計 GitHub Actions 流水線。
git clone yarn (a.k.a yarn install) yarn run build 產生好的靜態網站 Upload Artifact
GitHub Actions CI 推送時觸發此 Workflow 時區變更為 UTC+8 專案 Checkout 下來
GitHub Actions CI (cont.) 安裝 Node v16 安裝相依性套件、產生網頁 上傳產生後的網頁放到 GitHub
Artifact 上
5. 設定 GitHub Actions CD 上個步驟藉由 CI 把 Build 好的結果上傳到
Artifact 上,這裡只要下載回來即可。 Download Artifact git push 到其他專案 (或者你要 Deploy 到 FTP 上也可以)
GitHub Actions CD 下載剛剛上傳的 Artifact 需要完成上個 Job 才能做 Deploy Push
到其他的 Repo
GitHub Actions CD (cont.) 紀錄的 Secret name 目的 Repo 資
訊 目的 Repo 分 支
6. GitHub Pages 專案中設定 Branch 選擇 branch 就按下 Save 即可
None
以上 Demo 範例程式已經放在 GitHub 上 Hexo Source Repo: https://github.com/tico88612/cicd-hexo-blog-template GitHub
Pages Repo: https://github.com/tico88612/cicd-hexo-blog-pages Demo Site: https://cicd-blog.yangjerry.tw/
P a r t 4 Slido QA
Thank you ⚫ Website: https://yangjerry.tw ⚫ Blog: https://blog.yangjerry.tw ⚫ GitHub:
tico88612 ⚫ Instagram: @__tico88612__ ⚫ Discord: @tico88612#0001