From f7542cbc98b45351b60fb21e0bcbf18774d866c0 Mon Sep 17 00:00:00 2001 From: GwWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Fri, 2 Jan 2026 13:18:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(workflow):=20=E4=B8=BA=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?.NET=E6=B5=8B=E8=AF=95=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在auto-tag.yml中添加.NET环境设置步骤 - 添加NuGet包缓存配置以优化构建性能 - 添加依赖项恢复、构建和测试步骤 - 从publish.yml中移除重复的依赖项恢复和测试步骤 - 优化工作流配置以提高构建效率 --- .github/workflows/auto-tag.yml | 18 +++++++++++++++++- .github/workflows/publish.yml | 14 ++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index 1a37613..ef73d08 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -44,7 +44,23 @@ jobs: echo "No skip keyword found, proceeding with tag creation" fi echo "Last commit message: $LAST_COMMIT_MSG" - + + # 运行测试 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build -c Release --no-restore -p:DebugType=portable + - name: Test + run: dotnet test --no-build -c Release --verbosity normal # 步骤三:计算下一个版本号(若未被跳过) # 自动解析当前最新标签并递增修订号生成新的语义化版本号 - name: Get next version diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 203c277..e3319b5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,16 +35,14 @@ jobs: - name: Install unzip (for reading .nuspec from .nupkg) run: sudo apt-get update && sudo apt-get install -y unzip - + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} - name: Restore dependencies run: dotnet restore - - - name: Build - run: dotnet build -c Release --no-restore -p:DebugType=portable - - - name: Test - run: dotnet test --no-build -c Release --verbosity normal - + - name: Determine tag version id: tag_version run: |