From c7649c5521978569a31763db94ac6af3e9d0bede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Tue, 1 Jul 2025 02:40:26 +0800 Subject: [PATCH] Create nuget.yml --- .github/workflows/nuget.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/nuget.yml diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..c9f916a --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,33 @@ +name: 发布 BetterGI.Assets 到 NuGet + +on: + push: + branches: [ main ] + paths: + - 'BetterGI.Assets/**' + workflow_dispatch: # 允许手动触发 + +jobs: + build-and-publish: + runs-on: windows-latest + + steps: + - name: 检出代码 + uses: actions/checkout@v3 + + - name: 设置 .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: 还原依赖 + run: dotnet restore BetterGI.Assets\BetterGI.Assets.csproj + + - name: 构建项目 + run: dotnet build BetterGI.Assets\BetterGI.Assets.csproj --configuration Release --no-restore + + - name: 创建 NuGet 包 + run: dotnet pack BetterGI.Assets\BetterGI.Assets.csproj --configuration Release --no-build --output .\nupkgs + + - name: 发布到 NuGet + run: dotnet nuget push .\nupkgs\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate