commit 4bba16d2021227be1462f62895dd6e008f6777a5 Author: SRC0730 Date: Wed May 8 16:07:36 2024 +0800 feat: 新增 20240509_Git版控起手式 教材 diff --git a/README.md b/README.md new file mode 100644 index 0000000..b66fb03 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Tutorial Document + +此專案主要為教育訓練使用 + +## Report + +- [20240509_Git版控起手式](release/20240509_Git版控起手式.pdf) + +## 參考 Repo + +- [Tutorial_Git-UploadOldProject](http://twvoadtpw100004/OAD-WebTeam/Tutorial_Git-UploadOldProject) diff --git a/doc_image/Git.png b/doc_image/Git.png new file mode 100644 index 0000000..f4518b1 Binary files /dev/null and b/doc_image/Git.png differ diff --git a/doc_image/GitFlow.png b/doc_image/GitFlow.png new file mode 100644 index 0000000..b608bef Binary files /dev/null and b/doc_image/GitFlow.png differ diff --git a/doc_image/GitHubFlow.png b/doc_image/GitHubFlow.png new file mode 100644 index 0000000..a75da4e Binary files /dev/null and b/doc_image/GitHubFlow.png differ diff --git a/doc_image/Gitea.png b/doc_image/Gitea.png new file mode 100644 index 0000000..4bc69fb Binary files /dev/null and b/doc_image/Gitea.png differ diff --git a/doc_image/Sourcetree.jpg b/doc_image/Sourcetree.jpg new file mode 100644 index 0000000..cc31e5c Binary files /dev/null and b/doc_image/Sourcetree.jpg differ diff --git a/doc_image/Sourcetree.png b/doc_image/Sourcetree.png new file mode 100644 index 0000000..5453af8 Binary files /dev/null and b/doc_image/Sourcetree.png differ diff --git a/doc_image/SourcetreeLayout.png b/doc_image/SourcetreeLayout.png new file mode 100644 index 0000000..c82ae4c Binary files /dev/null and b/doc_image/SourcetreeLayout.png differ diff --git a/doc_image/VisualStudio.png b/doc_image/VisualStudio.png new file mode 100644 index 0000000..dde24b9 Binary files /dev/null and b/doc_image/VisualStudio.png differ diff --git a/doc_image/VisualStudioCode.png b/doc_image/VisualStudioCode.png new file mode 100644 index 0000000..dc4a67a Binary files /dev/null and b/doc_image/VisualStudioCode.png differ diff --git a/release/20240509_Git版控起手式.pdf b/release/20240509_Git版控起手式.pdf new file mode 100644 index 0000000..ae791cb Binary files /dev/null and b/release/20240509_Git版控起手式.pdf differ diff --git a/src/20240509_Git版控起手式.md b/src/20240509_Git版控起手式.md new file mode 100644 index 0000000..06502a5 --- /dev/null +++ b/src/20240509_Git版控起手式.md @@ -0,0 +1,171 @@ +--- +marp: true +theme: uncover +paginate: true +headingDivider: 3 +header: 20240509_Git版控起手式 +footer: OAD-WebTeam / Dave Mark +style: | + header { + text-align: left; + } + + footer { + text-right: right; + } + + ul li { + margin: 10px 0; + } + + table { + font-size: 25px; + width:100%; + } + + table img { + margin: 10px 0; + height: 150px; + } + + th:not(:first-child):not(:last-child), + td:not(:first-child):not(:last-child) { + border-left: 1px solid #999; + border-right: 1px solid #999; + } + + h3 { + text-align: left; + } + + section.content ul { + margin-left: 0; + font-size: 30px; + } + +--- + +# Git版控起手式 + + +> OAD-WebTeam / Dave Mark + +## 議程 + +- Git & Gitea 版控 +- CI/CD 自動佈署 +- 參考資料 + +## Git & Gitea 版控 + +## ![Git](../doc_image/Git.png) + +> [https://git-scm.com/](https://git-scm.com/) + +### **Git** vs **SVN** + +| | Git | SVN | +| ---------------- | ----------------------------------- | -------------------------------------- | +| **管理概念** | 分散式(distributed)
強調個體 | 集中式(centralized)
中央伺服器儲存 | +| **效能** | fast
local commit push server | slow
commit to server | +| **離線工作** | ⭕ | ❌ | +| **分支掌控度** | high
清楚知道Merge版本歷程 | low
無法分辨Merge版本 | +| **適用多人開發** | 較適合(搭配Flow) | 較困難 | +| **系統檔案** | 根目錄.git folder & .gitignore File | 每層目錄放.svn folder | +| **權限** | 使用帳號角色劃分 | 針對目錄做存取權限 | + +### Git Commit Message + + +- feat:新增或修改功能 +- fix:修補 bug +- docs:文件 +- style:格式 +- refactor:重構 +- perf:改善效能 +- test:增加測試 +- chore:maintain +- revert:撤銷回覆先前的 commit + +### Tools + +| Sourcetree | Visual Studio Code | Visual Studio | +| ------------------------------------------ | -------------------------------------------------------- | ----------------------------------------------- | +| ![Sourcetree](../doc_image/Sourcetree.png) | ![Visual Studio Code](../doc_image/VisualStudioCode.png) | ![Visual Studio](../doc_image/VisualStudio.png) | + +## ![Sourcetree](../doc_image/Sourcetree.png)
SourceTree + +![bg right](../doc_image/SourcetreeLayout.png) + +> [https://www.sourcetreeapp.com/](https://www.sourcetreeapp.com/) + +## ![Gitea](../doc_image/Gitea.png) + +> [https://about.gitea.com/](https://about.gitea.com/) + +### Gitea + + +- 跨平台:使用 **Go** 語言開發,可在 Windows、macOS、Linux 執行。 +- 安裝: + - Windows 搭配 Windows 服務 + - Docker image 建置 Linux 服務 +- 運作方式:比照 GitHub 方式以個人與組織方式運作,各 Repo 存取權限依照定義的帳號**角色**呈現。 +- CI/CD:搭配 **Gitea Action** 實作 + +### **Git Flow** vs **Github Flow** vs **GitLab Flow** ? + +### Git Flow + +![Git Flow](../doc_image/GitFlow.png) + +### GitHub Flow + +![GitHub Flow](../doc_image/GitHubFlow.png) + +## 實戰演練 Demo + +> [Tutorial_Git-UploadOldProject](http://twvoadtpw100004/OAD-WebTeam/Tutorial_Git-UploadOldProject) + +## CI/CD 自動佈署 + +### 什麼是 CI/CD ? + + +- 持續整合(Continuous Integration, CI) + - 建置:確保提交的程式碼是否可執行 + - 測試:確保功能正常與軟體品質 + - 程式碼分析:檢查 code style 或程式的穩健度 +- 持續交付/佈署(Continuous Delivery / Deployment, CD) + - 持續交付:自動將生產已就緒版本發佈到代碼存儲庫 + - 持續佈署:可以自動將應用發佈到生產環境 + +### CI/CD 準備工作 + + +- 持續整合(Continuous Integration, CI) + 1. 專案以純 Source Code 為主 + 2. 流程是否已可使用 command 處理? + 3. 建置環境是否備妥? SDK? +- 持續交付/佈署(Continuous Delivery / Deployment, CD) + 1. 流程是否已使用 command 處理? + 2. 目的與 Gitea Server Protocol 是否互通? 認證機制? + +### Gitea workflow + + +- Gitea 專案開啟 `Actions` 功能 +- 專案內建置 `.gitea/workflow/{腳本名稱}.yml` +- 觸發條件為何? `push branch develop` or `push branch release`? +- 工作事項簡單區分 build(CI) 及 deploy(CD) job +- 撰寫 command 腳本 (ex. Command Prompt、Windows PowerShell) +- 設計 Secrets 參數 (ex. 主機資訊、認證) +- Action Runner 工作事項 + +## 實戰演練 Demo + +## 參考資料 + +- [Gitbook](https://gitbook.tw/) +- [Git Commit](https://heidiliu2020.github.io/git-commit-message/) +- [Git Flow](https://gitbook.tw/chapters/gitflow/why-need-git-flow)