docs(AI Code Review): 補齊 action 與 workflow 註解說明
This commit is contained in:
@@ -1,25 +1,52 @@
|
||||
# 用途:master workflow 的 command-file 草稿,保留原始流程並補上逐行說明。
|
||||
# 更新時間:2026/07/11 19:00:45
|
||||
# workflow 名稱,對應 Gitea UI 中的顯示標題。
|
||||
name: CD
|
||||
# 定義此 workflow 的觸發事件。
|
||||
on:
|
||||
# 在 push 事件時執行。
|
||||
push:
|
||||
# 限定觸發分支。
|
||||
branches:
|
||||
- master
|
||||
# 只有推送到 master 分支才執行。
|
||||
- master
|
||||
# workflow 內的工作列表。
|
||||
jobs:
|
||||
# 單一 job:輸出 context、檢查 commit tag。
|
||||
deploy:
|
||||
# job 顯示名稱。
|
||||
name: DEPLOY
|
||||
# 使用 Ubuntu runner。
|
||||
runs-on: ubuntu
|
||||
# job 層級環境變數。
|
||||
env:
|
||||
# 將完整 Gitea context 轉成 JSON 字串。
|
||||
GITEA_CONTEXT: ${{ toJSON(gitea) }}
|
||||
# 取第二筆 commit 的 id 作為查詢目標。
|
||||
COMMIT_SHA: ${{ gitea.event.commits[1].id }}
|
||||
# deploy job 的步驟。
|
||||
steps:
|
||||
- name: Show Gitea Context
|
||||
run: echo "$GITEA_CONTEXT" | jq .
|
||||
- name: Source Code Checkout
|
||||
uses: actions/checkout@${{ vars.ACTION_CHECKOUT_VERSION }}
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Get Commit Tag
|
||||
id: commit
|
||||
run: echo "tag=$(git describe --contains ${{ env.COMMIT_SHA }})" >> $GITEA_OUTPUT
|
||||
- name: Show Tag
|
||||
run: echo "${{ steps.commit.outputs.tag }}"
|
||||
# 顯示 Gitea context。
|
||||
- name: Show Gitea Context
|
||||
# 將 context 格式化輸出。
|
||||
run: echo "$GITEA_CONTEXT" | jq .
|
||||
# 取回完整原始碼與 tags。
|
||||
- name: Source Code Checkout
|
||||
# 使用 checkout action。
|
||||
uses: actions/checkout@${{ vars.ACTION_CHECKOUT_VERSION }}
|
||||
# checkout 參數。
|
||||
with:
|
||||
# 取得完整歷史。
|
||||
fetch-depth: 0
|
||||
# 一併抓取 tags。
|
||||
fetch-tags: true
|
||||
# 查詢指定 commit 對應的 tag。
|
||||
- name: Get Commit Tag
|
||||
# 供後續步驟讀取輸出。
|
||||
id: commit
|
||||
# 把查到的 tag 寫入 action 輸出。
|
||||
run: echo "tag=$(git describe --contains ${{ env.COMMIT_SHA }})" >> $GITEA_OUTPUT
|
||||
# 顯示剛查到的 tag。
|
||||
- name: Show Tag
|
||||
# 將 tag 印到 log。
|
||||
run: echo "${{ steps.commit.outputs.tag }}"
|
||||
|
||||
Reference in New Issue
Block a user