Skip to content

Commit 1310b36

Browse files
committed
fix(ci): correct version output in build workflow
1 parent cac9616 commit 1310b36

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
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"
@@ -78,7 +78,7 @@ jobs:
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

Comments
 (0)