File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 1
- name : Publish NuGet Package
1
+ name : Publish NuGet Package on Tag
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - main
5
+ tags :
6
+ - ' v*.*.* '
7
7
8
8
jobs :
9
9
publish :
@@ -12,20 +12,29 @@ jobs:
12
12
steps :
13
13
- name : Checkout code
14
14
uses : actions/checkout@v3
15
+ with :
16
+ fetch-depth : 0
15
17
16
- - name : Setup .NET SDK
18
+ - name : Setup .NET
17
19
uses : actions/setup-dotnet@v4
18
20
with :
19
21
dotnet-version : 10.0.x
20
22
21
- - name : Restore dependencies
23
+ - name : Extract tag version
24
+ id : tag_version
25
+ run : |
26
+ TAG=${GITHUB_REF#refs/tags/}
27
+ echo "TAG_VERSION=${TAG#v}" >> $GITHUB_OUTPUT
28
+
29
+ - name : Restore
22
30
run : dotnet restore
23
31
24
32
- name : Build
25
33
run : dotnet build --configuration Release --no-restore
26
34
27
- - name : Pack NuGet
28
- run : dotnet pack --configuration Release --no-build -o out
35
+ - name : Pack
36
+ run : dotnet pack --configuration Release --no-build -o out \
37
+ -p:PackageVersion=${{ steps.tag_version.outputs.TAG_VERSION }}
29
38
30
39
- name : Push to NuGet
31
40
run : dotnet nuget push out/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
You can’t perform that action at this time.
0 commit comments