@@ -3,43 +3,42 @@ name: Publish NuGet Package
3
3
on :
4
4
push :
5
5
tags :
6
- - ' v*.*.*' # فقط زمانی اجرا میشه که tag مثل v1.2.3 اضافه بشه
6
+ - ' v*.*.*'
7
7
8
8
jobs :
9
9
publish :
10
10
runs-on : ubuntu-latest
11
11
12
12
steps :
13
- - name : Checkout code
14
- uses : actions/checkout@v3
15
-
16
- - name : Setup .NET
17
- uses : actions/setup-dotnet@v4
18
- with :
19
- dotnet-version : |
20
- 6.0.x
21
- 8.0.x
22
- 10.0.100-preview.4
23
-
24
- - name : Extract version from tag
25
- id : tag
26
- run : |
27
- echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
28
-
29
- - name : Restore dependencies
30
- run : dotnet restore
31
-
32
- - name : Build
33
- run : dotnet build --configuration Release --no-restore
34
-
35
- - name : Pack NuGet
36
- run : |
37
- dotnet pack --configuration Release \
38
- -p:PackageVersion=${{ steps.tag.outputs.VERSION }} \
39
- --no-build -o out
40
-
41
- - name : Push to NuGet
42
- run : |
43
- dotnet nuget push out/*.nupkg \
44
- --api-key ${{ secrets.NUGET_API_KEY }} \
45
- --source https://api.nuget.org/v3/index.json
13
+ - name : Checkout code
14
+ uses : actions/checkout@v3
15
+
16
+ - name : Setup .NET
17
+ uses : actions/setup-dotnet@v4
18
+ with :
19
+ dotnet-version : |
20
+ 6.0.x
21
+ 8.0.x
22
+
23
+ - name : Extract version from tag
24
+ id : tag
25
+ run : echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
26
+
27
+ - name : Restore dependencies
28
+ run : dotnet restore
29
+
30
+ - name : Build
31
+ run : dotnet build --configuration Release --no-restore
32
+
33
+ - name : Pack NuGet
34
+ run : |
35
+ dotnet pack --configuration Release \
36
+ -p:PackageVersion=${{ steps.tag.outputs.VERSION }} \
37
+ --no-build -o out
38
+
39
+ - 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
0 commit comments