From 1ed40a6b0410441b3ee8a7964ada9ded744c9388 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Sat, 11 Jul 2026 10:00:30 +0000 Subject: [PATCH] =?UTF-8?q?chore(action=20=E8=A8=AD=E5=AE=9A):=20=E6=95=B4?= =?UTF-8?q?=E7=90=86=E7=94=A8=E9=80=94=E6=A8=99=E9=A0=AD=E8=88=87=E6=8E=92?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yaml | 73 +++++++++++++++++++++------------------- Dockerfile | 5 +++ action.yml | 23 ++++++++----- entrypoint.sh | 5 +++ 4 files changed, 63 insertions(+), 43 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 7199df3..e6d542f 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -1,9 +1,14 @@ +# -------------------------------------------------- +# 用途:定義 CI 工作流程,處理 pull request 的版本發佈與測試。 +# 更新日期:2026/07/11 17:44:33(Asia/Taipei) +# -------------------------------------------------- + name: CI on: pull_request: branches: - - master - - develop + - master + - develop types: [opened, synchronize] jobs: build: @@ -16,13 +21,13 @@ jobs: version: ${{ env.VERSION }} is_beta: ${{ env.IS_BETA }} steps: - - name: Publishing Release - uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }} - with: - name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}" - tag_name: "v${{ env.VERSION }}" - target_commitish: ${{ gitea.sha }} - prerelease: ${{ env.IS_BETA }} + - name: Publishing Release + uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }} + with: + name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}" + tag_name: "v${{ env.VERSION }}" + target_commitish: ${{ gitea.sha }} + prerelease: ${{ env.IS_BETA }} test: name: 2. TEST runs-on: ubuntu @@ -33,36 +38,36 @@ jobs: outputs: version: ${{ steps.calculate-version.outputs.version }} steps: - - name: Run Calculate Version - id: calculate-version - uses: https://gitea.jsc.idv.tw/actions/calculate-version@v${{ env.VERSION }} - with: - is_beta: ${{ env.IS_BETA == "true" }} - - name: Setup LLM CLI - uses: https://gitea.jsc.idv.tw/actions/setup-${{ vars.ACTION_SETUP_LLM_CLI }} - if: ${{ env.IS_BETA == 'true' }} - with: - oauth: ${{ secrets.LLM_OAUTH }} - - name: Run AI Code Review - uses: https://gitea.jsc.idv.tw/actions/ai-code-review@${{ vars.ACTION_AI_CODE_REVIEW_VERSION }} - id: ai-code-review - if: ${{ env.IS_BETA == 'true' }} - with: - token: ${{ secrets.TOKEN }} - model: ${{ vars.LLM_NAME }} + - name: Run Calculate Version + id: calculate-version + uses: https://gitea.jsc.idv.tw/actions/calculate-version@v${{ env.VERSION }} + with: + is_beta: ${{ env.IS_BETA == "true" }} + - name: Setup LLM CLI + uses: https://gitea.jsc.idv.tw/actions/setup-${{ vars.ACTION_SETUP_LLM_CLI }} + if: ${{ env.IS_BETA == 'true' }} + with: + oauth: ${{ secrets.LLM_OAUTH }} + - name: Run AI Code Review + uses: https://gitea.jsc.idv.tw/actions/ai-code-review@${{ vars.ACTION_AI_CODE_REVIEW_VERSION }} + id: ai-code-review + if: ${{ env.IS_BETA == 'true' }} + with: + token: ${{ secrets.TOKEN }} + model: ${{ vars.LLM_NAME }} result: name: 3. RESULT runs-on: ubuntu - needs: [build,test] + needs: [build, test] if: ${{ needs.build.outputs.is_beta == 'false' }} env: VERSION: ${{ needs.test.outputs.version }} IS_BETA: ${{ needs.build.outputs.is_beta }} steps: - - name: Publishing Release - uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }} - with: - name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}" - tag_name: "v${{ env.VERSION }}" - target_commitish: ${{ gitea.sha }} - prerelease: ${{ env.IS_BETA == "true" }} + - name: Publishing Release + uses: akkuman/gitea-release-action@${{ vars.ACTION_GITEA_RELEASE_VERSION }} + with: + name: "${{ gitea.event.repository.name }} v${{ env.VERSION }}" + tag_name: "v${{ env.VERSION }}" + target_commitish: ${{ gitea.sha }} + prerelease: ${{ env.IS_BETA == "true" }} diff --git a/Dockerfile b/Dockerfile index e4751be..f2d8aca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,8 @@ +# -------------------------------------------------- +# 用途:定義 calculate-version action 的 Docker 執行環境。 +# 更新日期:2026/07/11 17:44:33(Asia/Taipei) +# -------------------------------------------------- + FROM node:lts-alpine WORKDIR /action diff --git a/action.yml b/action.yml index 009edd3..513435b 100644 --- a/action.yml +++ b/action.yml @@ -1,19 +1,24 @@ -name: 'Calculate Version' -description: '計算版本號' -author: 'Jeffery' +# -------------------------------------------------- +# 用途:宣告 Calculate Version action 的輸入、輸出與 Docker 執行方式。 +# 更新日期:2026/07/11 17:44:33(Asia/Taipei) +# -------------------------------------------------- + +name: "Calculate Version" +description: "計算版本號" +author: "Jeffery" inputs: is_beta: - description: '是否為 beta 版本' - default: 'false' + description: "是否為 beta 版本" + default: "false" runner_token: - description: '用於讀取 release 的 token' + description: "用於讀取 release 的 token" required: false outputs: version: - description: '計算出的版本號' + description: "計算出的版本號" runs: - using: 'docker' - image: 'Dockerfile' + using: "docker" + image: "Dockerfile" env: GITEA_SERVER_URL: ${{ gitea.server_url }} GITEA_REPOSITORY: ${{ gitea.repository }} diff --git a/entrypoint.sh b/entrypoint.sh index 14d6d5a..10ee879 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,9 @@ #!/bin/sh +# -------------------------------------------------- +# 用途:啟動 calculate-version action,將所有參數交給 Node 主程式。 +# 更新日期:2026/07/11 17:44:33(Asia/Taipei) +# -------------------------------------------------- + set -eu exec node /action/src/index.js "$@"