From d7cd868c044546faec18b28c7f7d3821824e0cb2 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Fri, 20 Mar 2026 16:49:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/master.yaml | 21 +++++++++++++-------- entrypoint.sh | 8 +++++--- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/master.yaml b/.gitea/workflows/master.yaml index 003e34f..ab25816 100644 --- a/.gitea/workflows/master.yaml +++ b/.gitea/workflows/master.yaml @@ -6,26 +6,31 @@ jobs: cd: name: "CD > 發布專案" runs-on: docker - outputs: - version: ${{ steps.version.outputs.version }} steps: - name: 發布專案 uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }} with: - tag_name: "v0.1.3" - - name: 計算版本號 - id: version - uses: https://gitea.jsc.idv.tw/actions/calculate-version@v0.1.3 + tag_name: "v0.1.4" - name: 清理舊版本 (保留最新2個) uses: https://gitea.jsc.idv.tw/actions/cleanup-release@${{ vars.ACTION_CLEANUP_RELEASE_VERSION }} with: gitea-server: ${{ gitea.server_url }} repository: ${{ gitea.repository }} token: ${{ secrets.GITEA_TOKEN }} - test: + test-calculate: + name: "TEST > 計算版本號" + runs-on: docker needs: cd + outputs: + version: ${{ steps.version.outputs.VERSION }} + steps: + - name: 計算版本號 + id: version + uses: https://gitea.jsc.idv.tw/actions/calculate-version@v0.1.4 + test: name: "TEST > 測試專案" runs-on: docker + needs: test-calculate steps: - name: 顯示版本號 - run: echo ${{ needs.cd.outputs.version }} \ No newline at end of file + run: echo ${{ needs.test-calculate.outputs.VERSION }} \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index cf9c246..0b467e5 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -67,11 +67,13 @@ PATCH=$((PATCH + 1)) # 如果 MINOR >= 10,重置為 0 並增加 MAJOR 版本 [ $MINOR -ge 10 ] && { MINOR=0; MAJOR=$((MAJOR + 1)); } -# 組合新的版本號 -NEW_VERSION="$MAJOR.$MINOR.$PATCH" +# 組合新的版本號,並顯示 +NEW_VERSION="$MAJOR.$MINOR.$PATCH" && echo "NEW_VERSION=$NEW_VERSION" # 確保 GITHUB_OUTPUT 檔案的目錄存在 mkdir -p "$(dirname "$GITHUB_OUTPUT")" # 將版本輸出到環境變數 -echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT \ No newline at end of file +echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT + +exit 0 \ No newline at end of file -- 2.48.1