Files
cleanup-release/.gitea/workflows/master.yaml
T

40 lines
1.2 KiB
YAML

# 檔案用途:在 master 分支推送後進行部署相關檢查與標籤顯示
# 更新日期:2026/07/11 21:02:25
# Workflow 名稱,代表這條 CD 流程
name: CD
# 觸發條件設定
on:
# 只有 push 到 master 分支時才執行
push:
branches:
- master
# 工作流程中的 jobs
jobs:
# 部署階段,負責取 commit tag 並輸出
deploy:
# Job 名稱,會顯示在 UI 中
name: DEPLOY
# 執行環境為 Ubuntu runner
runs-on: ubuntu
# 設定環境變數,取出第二個 commit 的 id
env:
COMMIT_SHA: ${{ gitea.event.commits[1].id }}
# 具體步驟
steps:
# checkout source code,供後續 git describe 使用
- name: Source Code Checkout
uses: actions/checkout@${{ vars.ACTION_CHECKOUT_VERSION }}
with:
# 保留完整歷史,讓 git describe 可運作
fetch-depth: 0
# 取出包含目前 commit 的 tag
- name: Get Commit Tag
id: commit
run: echo "tag=$(git describe --contains ${{ env.COMMIT_SHA }})" >> $GITEA_OUTPUT
# 顯示 tag,讓執行紀錄可直接查看
- name: Show Tag
run: echo "${{ steps.commit.outputs.tag }}"