Files
action-cd/action.yml
T
bot 87ec8ee1b8
ci / test (push) Successful in 2s
初始版本
2026-11-05 04:12:39 +00:00

45 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: action-cd
description: "action repo 的共用 CD:checkout(PR 來源最新提交)→ next-version 算下一版 → 沒有跳過就打標籤並推送。只動文件、圖示、測試、.gitea/、go.mod 時跳過。內部用的 next-version 版本取自呼叫端的 Gitea 變數 ACTION_NEXT_VERSION_VERSION"
inputs:
token:
description: "推送標籤用的權杖(需要 write:repository);空=用內建 github.token"
default: ""
docs_pattern:
description: "只動這些檔案就不發版的 egrep 規則"
default: '^\.gitea/|^icon\.|^test/|^go\.mod$|\.md$'
outputs:
version:
description: "這次發的版本(跳過時是下一版的預覽,沒有實際推送)"
value: ${{ steps.ver.outputs.version }}
skip:
description: "true=只動文件等檔案,沒有發版"
value: ${{ steps.ver.outputs.skip }}
runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ inputs.token || github.token }}
- id: ver
uses: https://gitea.jsc.idv.tw/actions/next-version@${{ vars.ACTION_NEXT_VERSION_VERSION }}
with:
channel: release
docs_pattern: ${{ inputs.docs_pattern }}
- name: 只動文件等檔案,不發版
if: ${{ steps.ver.outputs.skip == 'true' }}
shell: bash
run: echo "不發版"
- name: 打標籤並推送
if: ${{ steps.ver.outputs.skip != 'true' }}
shell: bash
env:
VERSION: ${{ steps.ver.outputs.version }}
TOKEN: ${{ inputs.token || github.token }}
run: |
set -euo pipefail
git tag "$VERSION" HEAD
git push "${GITHUB_SERVER_URL%%://*}://oauth2:${TOKEN}@${GITHUB_SERVER_URL#*://}/${GITHUB_REPOSITORY}.git" "refs/tags/$VERSION"
echo "已推送標籤 $VERSION"