We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0823e1 commit 0038b55Copy full SHA for 0038b55
1 file changed
.github/workflows/deploy-nuget.yml
@@ -0,0 +1,31 @@
1
+name: Publish NuGet Package
2
+
3
+on:
4
+ push:
5
+ tags:
6
+ - 'v*' # 当推送以 v 开头的标签时触发,例如 v0.9
7
8
+jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout Code
13
+ uses: actions/checkout@v4
14
15
+ - name: Setup .NET
16
+ uses: actions/setup-net@v4
17
+ with:
18
+ dotnet-version: '8.0.x' # 根据你的项目选择版本
19
20
+ - name: Restore dependencies
21
+ run: dotnet restore
22
23
+ - name: Build
24
+ run: dotnet build --configuration Release --no-restore
25
26
+ # 自动从 Tag 名称提取版本号并打包
27
+ - name: Pack
28
+ run: dotnet pack --configuration Release /p:PackageVersion=${{ github.ref_name }} --output .
29
30
+ - name: Publish to NuGet
31
+ run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_AUTH_TOKEN }} --source https://api.nuget.org/v3/index.json --skip-duplicate
0 commit comments