From e79d18c3b465f5c450a1d6ba0edc6d9d51c7b13b Mon Sep 17 00:00:00 2001 From: yedajiang44 <602830483@qq.com> Date: Tue, 27 Aug 2024 10:12:13 +0800 Subject: [PATCH] Create nuget.yaml --- .github/workflows/nuget.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/nuget.yaml diff --git a/.github/workflows/nuget.yaml b/.github/workflows/nuget.yaml new file mode 100644 index 0000000..2b59aa8 --- /dev/null +++ b/.github/workflows/nuget.yaml @@ -0,0 +1,33 @@ +name: Publish NuGet Package + +on: + push: + tags: + - 'v*' # 触发条件为推送符合 v* 格式的标签,例如 v1.0.0 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.203' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Pack NuGet package + run: dotnet pack --configuration Release --no-build --output ./output + + - name: Publish to NuGet + run: dotnet nuget push ./output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}