File tree Expand file tree Collapse file tree 2 files changed +47
-13
lines changed Expand file tree Collapse file tree 2 files changed +47
-13
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ name: Publish NuGet Package
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - main
5
7
tags :
6
8
- ' v*.*.*'
7
9
@@ -13,16 +15,19 @@ jobs:
13
15
- name : Checkout code
14
16
uses : actions/checkout@v3
15
17
16
- - name : Setup .NET
18
+ - name : Setup .NET SDK
17
19
uses : actions/setup-dotnet@v4
18
20
with :
19
21
dotnet-version : |
20
22
6.0.x
21
23
8.0.x
22
24
23
- - name : Extract version from tag
24
- id : tag
25
- run : echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
25
+ - name : Install GitVersion
26
+ uses :
gittools/actions/gitversion/[email protected]
27
+
28
+ - name : Use GitVersion to get version info
29
+ id : gitversion
30
+ run : gitversion /output json /showvariable SemVer
26
31
27
32
- name : Restore dependencies
28
33
run : dotnet restore
31
36
run : dotnet build --configuration Release --no-restore
32
37
33
38
- name : Pack NuGet
34
- run : |
35
- dotnet pack --configuration Release \
36
- -p:PackageVersion=${{ steps.tag.outputs.VERSION }} \
37
- --no-build -o out
39
+ run : dotnet pack --configuration Release -p:PackageVersion=${{ steps.gitversion.outputs.SemVer }} --no-build -o out
38
40
39
41
- name : Push to NuGet
40
- if : success() && steps.tag.outputs.VERSION != ''
41
- run : |
42
- dotnet nuget push out/*.nupkg \
43
- --api-key ${{ secrets.NUGET_API_KEY }} \
44
- --source https://api.nuget.org/v3/index.json
42
+ if : success() && github.event_name == 'push'
43
+ run : dotnet nuget push out/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
Original file line number Diff line number Diff line change
1
+ mode : ContinuousDelivery
2
+
3
+ branches :
4
+ main :
5
+ regex : ^main$
6
+ increment : Minor
7
+ prevent-increment-of-merged-branch-version : true
8
+ track-merge-target : false
9
+ tag : ' '
10
+
11
+ develop :
12
+ regex : ^develop$
13
+ increment : Patch
14
+ tag : ' beta'
15
+
16
+ feature :
17
+ regex : ^feature[/-]
18
+ increment : Patch
19
+ tag : ' alpha'
20
+
21
+ bugfix :
22
+ regex : ^bugfix[/-]
23
+ increment : Patch
24
+ tag : ' alpha'
25
+
26
+ release :
27
+ regex : ^release[/-]
28
+ increment : Patch
29
+ tag : ' rc'
30
+
31
+ ignore :
32
+ sha : []
33
+
34
+ commit-message-incrementing : Enabled
35
+
You can’t perform that action at this time.
0 commit comments