GITHUB ACTION
實現持續整合與持續部署 Customer Engineer
Duran Hsieh
OUTLINE
• Introduction
• Workflows and YAML syntax
• GitHub Event
• Environment Variables & Secrets
• CI and Deployment
3
Presented By: Duran Hsieh
ABOUT ME
• Duran Hsieh
• Microsoft CE (App)
• Other position
• Senior .NET Developer
• Study4.TW .NET Community
Member
• Taichung Google Developer
Group Co-Organizer
• 2016-2018 Microsoft MVP
(VSDT)
4
Presented By: Duran Hsieh
ABOUT ME
• Skill
• Load/Performance Test
• .NET/.NET Core application development
• IIS performance tuning
• Azure App/Storage/SQL/DevOps
• Android
• TeamCity/Jenkins
5
Presented By: Duran Hsieh
ABOUT ME
• Certification
• MCSA: Web Applications
• MCSD: Web Applications
• MCSD: App Builder
• Oracle Certified Professional, Java SE 6 Programmer
• MS: Programming in HTML5 with JavaScript and CSS3
• Oracle Database SQL Certified Expert
• Oracle Database 10g Administrator Certified Associate
• Oracle Database 10g Administrator Certified
• (Course completion confirmation) M102: MongoDB for DBAs
• (Course completion confirmation) M101N: MongoDB for .NET
Developers
• Microsoft Certified: Azure Fundamentals
• Microsoft Certified: Azure Developer Associate
6
Presented By: Duran Hsieh
ABOUT ME
• Award
• 2011資訊教育與科技應用研討會專題競賽佳作(Excellent Work)
• 2010 Open Source and Creative Application Contest (Silver Medal
Award)
• 2012跨領域創意網路通訊應用與服務競賽 (特優)
• IBM Taiwan 2011 z Master Contest (Excellent Performance in Part II)
• The 2012 Network Communication software and Creative Application
Contest Award (First Prize)
• 2014第7屆IT邦幫忙鐵人賽入圍 佳作(Excellent Work)
• 2015 Microsoft Community Challenge (Second Prize)
• 2017第8屆IT邦幫忙鐵人賽 佳作(Excellent Work)
• 2018第9屆IT邦幫忙鐵人賽 佳作(Excellent Work)
• 2018 智在家鄉 聯發科技數位社會創新競賽 首獎 (First Prize)
7
Presented By: Duran Hsieh
ABOUT ME
• Other
• Blog : http://dog0416.blogspot.com/
• GitHub : https://github.com/matsurigoto/
• Bitbucket : https://bitbucket.org/matsurigoto/
• DockerHub : https://hub.docker.com/u/matsurigoto/
INTRODUCTION
9
Presented By: Duran Hsieh
INTRODUCTION
• GitHub Actions
• 在 GitHub Repo 內自訂且自動執行軟體開發流程
• 建立或共享自動化工作 (Job)
• 豐富的觸發程序 (Event)
• 達到自動化、持續整合與持續交付目的
• 豐富的第三方套件可以使用
10
Presented By: Duran Hsieh
INTRODUCTION
• Automation
• 對於第一次建立 Pull Request 貢獻人員打招呼
• 自動使用 Label 分類 Pull Request
• Continue Integration and Deployment
• 還原 (Restore)、建置 (Build)、測試 (Test) 應用程式
• 分析、掃描原始程式
• 相依性分析
• 佈署應用程式
• 雲端服務
• 地端環境
Why?
11
Presented By: Duran Hsieh
INTRODUCTION
• 掃描原始程式 & 相依性分析
• GitHub 發展流程起源於 Community
• 以開源協作為主軸提供功能
• 安全性非常重要
• Public Repo 預設免費開啟
Secure your DevOps = DevSecOps
• 安全測試左移
越接近交付前發現安全漏洞並進行修復
耗損的成本越高
WORKFLOWS
13
Presented By: Duran Hsieh
WORKFLOWS
• Workflows
14
Presented By: Duran Hsieh
WORKFLOWS
• Event
• 觸發自動化工作流程的功能
• GitHub Action 有豐富的觸情境
• Jobs
• Job 是在同一個 Runner 執行的一組 Step
• 預設情況下這些工作會平行執行,你也能設定循序執行
• 當其中一個 Job 失敗後,下一個 Job 不會執行
• Step
• 在 Job 內可以執行命令獨立工作
• Step 可以是一個命令或一個 Action
• 同一個 Job 內允許所有 Action 共享資料
15
Presented By: Duran Hsieh
WORKFLOWS
• Action
• 獨立的執行內容,可以自行撰寫,也可以使用 GitHub 社群創作的
Action 來完成工作流程
• Runner
• 代理程式,負責執行自動化程式的伺服器
• 可運作在 Ubuntu Linux、Microsoft Windows 和 macOS 上
• 預設 GitHub 提供,但私有專案須付費 (以時間計)
16
Presented By: Duran Hsieh
WORKFLOWS
17
Presented By: Duran Hsieh
WORKFLOWS
• Self-hosted runners
• 優點
• 自有主機,無須收取費用 (使用時間限制)
• 可以高度自訂自動化流程
• 缺點
• 需要自有主機
• 自行維護作業系統、網路…等硬體設施
• 需要自行安裝相關套件 (SDK、Runtime…)
執行第三方 Action 時,須注意有沒有惡意指令
18
Presented By: Duran Hsieh
WORKFLOWS
• Demo
• YAML - Hello world !!
GITHUB EVENT
20
Presented By: Duran Hsieh
GITHUB EVENT
• Event
• 特定事件
• 特定時間
• 外部事件觸發 (API)
21
Presented By: Duran Hsieh
GITHUB EVENT
22
Presented By: Duran Hsieh
GITHUB EVENT
23
Presented By: Duran Hsieh
GITHUB EVENT
24
Presented By: Duran Hsieh
GITHUB EVENT
ENVIRONMENT
VARIABLES & SECRETS
26
Presented By: Duran Hsieh
ENVIRONMENT VARIABLES & SECRETS
• 環境變數
• 檔案內使用
• 在 job 中以 env: 宣告變數
• 在後續以 ${{ <expression> }} 方式使用
27
Presented By: Duran Hsieh
ENVIRONMENT VARIABLES & SECRETS
• 進階使用 – 宣告後續使用
• 在 self-host runner 內設定環境變數並取用
• 依作業系統版本不同,語法不同
28
Presented By: Duran Hsieh
ENVIRONMENT VARIABLES & SECRETS
• 秘密
• workflow 需要一些敏感資訊才能與其他服務互動
• API Key
• Password
• …
• 在 Setting 內設定 Secret 會加密,且在執行 workflow
隱藏內容
使用第三方 Action 時須注意是否有列印 Secret 指令!!
CI
AND DEPLOYMENT
30
Presented By: Duran Hsieh
INTRODUCTION
• CI 以 ASP.NET Core 為例
31
Presented By: Duran Hsieh
INTRODUCTION
• YAML
32
Presented By: Duran Hsieh
INTRODUCTION
• Deployment
• 雲端服務
33
Presented By: Duran Hsieh
INTRODUCTION
• 地端環境 1
34
Presented By: Duran Hsieh
INTRODUCTION
• 地端環境 2
35
Presented By: Duran Hsieh
INTRODUCTION
• 地端環境 3
QUESTION & ANSWERS
THANK YOU FOR
WATCHING

GitHub Action Introduction

  • 1.
  • 2.
    OUTLINE • Introduction • Workflowsand YAML syntax • GitHub Event • Environment Variables & Secrets • CI and Deployment
  • 3.
    3 Presented By: DuranHsieh ABOUT ME • Duran Hsieh • Microsoft CE (App) • Other position • Senior .NET Developer • Study4.TW .NET Community Member • Taichung Google Developer Group Co-Organizer • 2016-2018 Microsoft MVP (VSDT)
  • 4.
    4 Presented By: DuranHsieh ABOUT ME • Skill • Load/Performance Test • .NET/.NET Core application development • IIS performance tuning • Azure App/Storage/SQL/DevOps • Android • TeamCity/Jenkins
  • 5.
    5 Presented By: DuranHsieh ABOUT ME • Certification • MCSA: Web Applications • MCSD: Web Applications • MCSD: App Builder • Oracle Certified Professional, Java SE 6 Programmer • MS: Programming in HTML5 with JavaScript and CSS3 • Oracle Database SQL Certified Expert • Oracle Database 10g Administrator Certified Associate • Oracle Database 10g Administrator Certified • (Course completion confirmation) M102: MongoDB for DBAs • (Course completion confirmation) M101N: MongoDB for .NET Developers • Microsoft Certified: Azure Fundamentals • Microsoft Certified: Azure Developer Associate
  • 6.
    6 Presented By: DuranHsieh ABOUT ME • Award • 2011資訊教育與科技應用研討會專題競賽佳作(Excellent Work) • 2010 Open Source and Creative Application Contest (Silver Medal Award) • 2012跨領域創意網路通訊應用與服務競賽 (特優) • IBM Taiwan 2011 z Master Contest (Excellent Performance in Part II) • The 2012 Network Communication software and Creative Application Contest Award (First Prize) • 2014第7屆IT邦幫忙鐵人賽入圍 佳作(Excellent Work) • 2015 Microsoft Community Challenge (Second Prize) • 2017第8屆IT邦幫忙鐵人賽 佳作(Excellent Work) • 2018第9屆IT邦幫忙鐵人賽 佳作(Excellent Work) • 2018 智在家鄉 聯發科技數位社會創新競賽 首獎 (First Prize)
  • 7.
    7 Presented By: DuranHsieh ABOUT ME • Other • Blog : http://dog0416.blogspot.com/ • GitHub : https://github.com/matsurigoto/ • Bitbucket : https://bitbucket.org/matsurigoto/ • DockerHub : https://hub.docker.com/u/matsurigoto/
  • 8.
  • 9.
    9 Presented By: DuranHsieh INTRODUCTION • GitHub Actions • 在 GitHub Repo 內自訂且自動執行軟體開發流程 • 建立或共享自動化工作 (Job) • 豐富的觸發程序 (Event) • 達到自動化、持續整合與持續交付目的 • 豐富的第三方套件可以使用
  • 10.
    10 Presented By: DuranHsieh INTRODUCTION • Automation • 對於第一次建立 Pull Request 貢獻人員打招呼 • 自動使用 Label 分類 Pull Request • Continue Integration and Deployment • 還原 (Restore)、建置 (Build)、測試 (Test) 應用程式 • 分析、掃描原始程式 • 相依性分析 • 佈署應用程式 • 雲端服務 • 地端環境 Why?
  • 11.
    11 Presented By: DuranHsieh INTRODUCTION • 掃描原始程式 & 相依性分析 • GitHub 發展流程起源於 Community • 以開源協作為主軸提供功能 • 安全性非常重要 • Public Repo 預設免費開啟 Secure your DevOps = DevSecOps • 安全測試左移 越接近交付前發現安全漏洞並進行修復 耗損的成本越高
  • 12.
  • 13.
    13 Presented By: DuranHsieh WORKFLOWS • Workflows
  • 14.
    14 Presented By: DuranHsieh WORKFLOWS • Event • 觸發自動化工作流程的功能 • GitHub Action 有豐富的觸情境 • Jobs • Job 是在同一個 Runner 執行的一組 Step • 預設情況下這些工作會平行執行,你也能設定循序執行 • 當其中一個 Job 失敗後,下一個 Job 不會執行 • Step • 在 Job 內可以執行命令獨立工作 • Step 可以是一個命令或一個 Action • 同一個 Job 內允許所有 Action 共享資料
  • 15.
    15 Presented By: DuranHsieh WORKFLOWS • Action • 獨立的執行內容,可以自行撰寫,也可以使用 GitHub 社群創作的 Action 來完成工作流程 • Runner • 代理程式,負責執行自動化程式的伺服器 • 可運作在 Ubuntu Linux、Microsoft Windows 和 macOS 上 • 預設 GitHub 提供,但私有專案須付費 (以時間計)
  • 16.
    16 Presented By: DuranHsieh WORKFLOWS
  • 17.
    17 Presented By: DuranHsieh WORKFLOWS • Self-hosted runners • 優點 • 自有主機,無須收取費用 (使用時間限制) • 可以高度自訂自動化流程 • 缺點 • 需要自有主機 • 自行維護作業系統、網路…等硬體設施 • 需要自行安裝相關套件 (SDK、Runtime…) 執行第三方 Action 時,須注意有沒有惡意指令
  • 18.
    18 Presented By: DuranHsieh WORKFLOWS • Demo • YAML - Hello world !!
  • 19.
  • 20.
    20 Presented By: DuranHsieh GITHUB EVENT • Event • 特定事件 • 特定時間 • 外部事件觸發 (API)
  • 21.
    21 Presented By: DuranHsieh GITHUB EVENT
  • 22.
    22 Presented By: DuranHsieh GITHUB EVENT
  • 23.
    23 Presented By: DuranHsieh GITHUB EVENT
  • 24.
    24 Presented By: DuranHsieh GITHUB EVENT
  • 25.
  • 26.
    26 Presented By: DuranHsieh ENVIRONMENT VARIABLES & SECRETS • 環境變數 • 檔案內使用 • 在 job 中以 env: 宣告變數 • 在後續以 ${{ <expression> }} 方式使用
  • 27.
    27 Presented By: DuranHsieh ENVIRONMENT VARIABLES & SECRETS • 進階使用 – 宣告後續使用 • 在 self-host runner 內設定環境變數並取用 • 依作業系統版本不同,語法不同
  • 28.
    28 Presented By: DuranHsieh ENVIRONMENT VARIABLES & SECRETS • 秘密 • workflow 需要一些敏感資訊才能與其他服務互動 • API Key • Password • … • 在 Setting 內設定 Secret 會加密,且在執行 workflow 隱藏內容 使用第三方 Action 時須注意是否有列印 Secret 指令!!
  • 29.
  • 30.
    30 Presented By: DuranHsieh INTRODUCTION • CI 以 ASP.NET Core 為例
  • 31.
    31 Presented By: DuranHsieh INTRODUCTION • YAML
  • 32.
    32 Presented By: DuranHsieh INTRODUCTION • Deployment • 雲端服務
  • 33.
    33 Presented By: DuranHsieh INTRODUCTION • 地端環境 1
  • 34.
    34 Presented By: DuranHsieh INTRODUCTION • 地端環境 2
  • 35.
    35 Presented By: DuranHsieh INTRODUCTION • 地端環境 3
  • 36.
  • 37.

Editor's Notes

  • #5 I have extensive experience in Load test, Performance Test, .NET/.NET Core application development, IIS performance tuning ,Azure App/Storage/SQL/DevOps , Android, TeamCity
  • #11 多數 DevOps 工具著重以自動化與專案管理功能切入
  • #12 因為多數的團隊會認為安全工具的導入會影響開發速度,導致時程延宕 但管理者沒有發現的是在軟體開發流程中,越接近交付前發現安全漏洞並進行修復,耗損的成本越高,更不用說是已經上線的系統,