74 lines
2.5 KiB
YAML
74 lines
2.5 KiB
YAML
# --------------------------------------------------
|
||
# 用途:定義 CI 工作流程,處理 pull request 的版本發佈與測試。
|
||
# 更新日期:2026/07/11 17:44:33(Asia/Taipei)
|
||
# --------------------------------------------------
|
||
|
||
name: CI
|
||
on:
|
||
pull_request:
|
||
branches:
|
||
- master
|
||
- develop
|
||
types: [opened, synchronize]
|
||
jobs:
|
||
build:
|
||
name: 1. BUILD
|
||
runs-on: ubuntu
|
||
env:
|
||
VERSION: "0.0.0-beta.${{ gitea.run_number }}"
|
||
IS_BETA: ${{ gitea.base_ref == 'develop' }}
|
||
outputs:
|
||
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 }}
|
||
test:
|
||
name: 2. TEST
|
||
runs-on: ubuntu
|
||
needs: [build]
|
||
env:
|
||
VERSION: ${{ needs.build.outputs.version }}
|
||
IS_BETA: ${{ needs.build.outputs.is_beta }}
|
||
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 }}
|
||
result:
|
||
name: 3. RESULT
|
||
runs-on: ubuntu
|
||
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" }}
|