3636 name : Build and Test
3737 runs-on : ubuntu-latest
3838 outputs :
39- version : ${{ steps.nbgv.outputs.version }}
39+ version : ${{ steps.nbgv.outputs.SemVer2 }}
4040
4141 steps :
4242 - name : Checkout code
@@ -48,23 +48,23 @@ jobs:
4848 uses : actions/setup-dotnet@v4
4949 with :
5050 dotnet-version : ${{ inputs.dotnet-version }}
51+ global-json-file : ./global.json
5152
52- - name : Install Nerdbank.GitVersioning
53- run : dotnet tool install -g nbgv
54-
55- - name : Set version with NBGV
53+ - name : Calculate Version with NBGV
54+ uses : dotnet/nbgv@master
5655 id : nbgv
56+ with :
57+ setAllVars : true
58+
59+ - name : Version Info
5760 run : |
58- nbgv get-version --format json > version.json
59- VERSION=$(nbgv get-version -v NuGetPackageVersion)
60- echo "version=$VERSION" >> $GITHUB_OUTPUT
61- echo "Calculated version: $VERSION"
61+ echo "Calculated version: ${{ steps.nbgv.outputs.SemVer2 }}"
6262
6363 - name : Restore dependencies
6464 run : dotnet restore
6565
6666 - name : Build
67- run : dotnet build --configuration ${{ inputs.configuration }} --no-restore
67+ run : dotnet build --configuration ${{ inputs.configuration }} --no-restore /p:Version=${{ steps.nbgv.outputs.SemVer2 }}
6868
6969 - name : Test
7070 run : dotnet test --configuration ${{ inputs.configuration }} --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
7878
7979 - name : Pack NuGet packages
8080 if : inputs.create-pack
81- run : dotnet pack --configuration ${{ inputs.configuration }} --no-build --output ./artifacts
81+ run : dotnet pack --configuration ${{ inputs.configuration }} --no-build --output ./artifacts /p:PackageVersion=${{ steps.nbgv.outputs.SemVer2 }}
8282
8383 - name : Upload NuGet packages
8484 if : inputs.create-pack
0 commit comments