feat(plugin): 添加 NuGet 包发布配置

- 添加包元数据到 csproj
- 创建 nuget.yml 发布工作流
This commit is contained in:
movingsam 2026-03-01 17:10:06 +08:00
parent 09957364e2
commit 4839366227
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,40 @@
name: Build and Publish NuGet Package
on:
push:
branches: [main]
paths:
- 'src/Fengling.Gateway.Plugin.Abstractions/**'
release:
types: [published]
env:
REGISTRY: gitea.shtao1.cn
PACKAGE_NAME: Fengling.Gateway.Plugin.Abstractions
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.103'
- name: Restore dependencies
run: dotnet restore src/Fengling.Gateway.Plugin.Abstractions/Fengling.Gateway.Plugin.Abstractions.csproj
- name: Build
run: dotnet build src/Fengling.Gateway.Plugin.Abstractions/Fengling.Gateway.Plugin.Abstractions.csproj --configuration Release --no-restore
- name: Pack
run: dotnet pack src/Fengling.Gateway.Plugin.Abstractions/Fengling.Gateway.Plugin.Abstractions.csproj --configuration Release --no-build -o ./nupkg
- name: Publish to Gitea
run: |
dotnet nuget push ./nupkg/*.nupkg \
--source ${{ env.REGISTRY }}/api/packages/${{ github.repository_owner }}/nuget/index.json \
--username fengling \
--password ${{ secrets.GITEATOKEN }}

View File

@ -5,6 +5,14 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Fengling.Gateway.Plugin.Abstractions</RootNamespace>
<!-- NuGet Package Metadata -->
<PackageId>Fengling.Gateway.Plugin.Abstractions</PackageId>
<Version>1.0.0</Version>
<Authors>Fengling</Authors>
<Company>Fengling</Company>
<Product>Fengling Gateway Plugin</Product>
<Description>Gateway plugin abstractions for YARP reverse proxy</Description>
</PropertyGroup>
<ItemGroup>