99 runs-on : ubuntu-latest
1010
1111 steps :
12- # Checkout the code
1312 - name : Checkout code
1413 uses : actions/checkout@v3
1514 with :
16- fetch-depth : 0 # Ensure all history is fetched so GitVersion can access tags
17-
18- # Setup .NET
15+ fetch-depth : 0
16+
1917 - name : Setup .NET
2018 uses : actions/setup-dotnet@v3
2119 with :
2220 dotnet-version : ' 8.0.x'
23-
24- # Restore dependencies
21+
2522 - name : Restore dependencies
2623 run : dotnet restore
27-
28- # Install GitVersion
24+
2925 - name : Install GitVersion
3026 run : dotnet tool install --global GitVersion.Tool
31-
32- # Ensure GitVersion is in the PATH
33- - name : Add GitVersion to PATH
34- run : echo "::add-path::$HOME/.dotnet/tools"
35-
36- # Get version using GitVersion
37- - name : Use GitVersion to Calculate Version
27+
28+ - name : Ensure GitVersion is in PATH
29+ run : echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
30+
31+ - name : Get version with GitVersion
3832 id : gitversion
3933 run : |
40- dotnet-gitversion /output json > gitversion.json
41- VERSION=$(jq -r .NuGetVersion gitversion.json)
34+ VERSION=$(dotnet-gitversion /showvariable NuGetVersion)
4235 echo "VERSION=$VERSION" >> $GITHUB_ENV
43-
44- # Build the project
36+
37+ - name : Display version
38+ run : echo "Version is ${{ env.VERSION }}"
39+
4540 - name : Build
4641 run : dotnet build --configuration Release --no-restore
47-
48- # Run tests
42+
4943 - name : Run tests
5044 run : dotnet test --configuration Release --no-build --verbosity normal
51-
52- # Pack the project into a NuGet package
45+
5346 - name : Pack
5447 run : dotnet pack --configuration Release --no-build --output ./nupkg /p:PackageVersion=${{ env.VERSION }}
55-
56- # Publish the NuGet package
48+
5749 - name : Publish to NuGet
5850 env :
5951 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
60- run : dotnet nuget push ./nupkg/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
52+ run : dotnet nuget push ./nupkg/*.nupkg --api-key $
0 commit comments