Skip to content

Commit 091fa28

Browse files
committed
GitHub Actions: Clear version suffix when set in project files
Using MSBuild property because the `-version-suffix` switch does not accept null or an empty string
1 parent 88d7814 commit 091fa28

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,7 @@ jobs:
124124
- name: Build
125125
shell: pwsh
126126
run: |
127-
if ($env:PACKAGE_VERSION_SUFFIX) {
128-
dotnet build --no-restore --configuration Release --version-suffix=$env:PACKAGE_VERSION_SUFFIX
129-
}
130-
else {
131-
dotnet build --no-restore --configuration Release
132-
}
127+
dotnet build --no-restore --configuration Release /p:VersionSuffix=$env:PACKAGE_VERSION_SUFFIX
133128
- name: Test
134129
run: |
135130
dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true" -- RunConfiguration.CollectSourceInformation=true DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true
@@ -139,12 +134,7 @@ jobs:
139134
- name: Generate packages
140135
shell: pwsh
141136
run: |
142-
if ($env:PACKAGE_VERSION_SUFFIX) {
143-
dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages --version-suffix=$env:PACKAGE_VERSION_SUFFIX
144-
}
145-
else {
146-
dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages
147-
}
137+
dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages /p:VersionSuffix=$env:PACKAGE_VERSION_SUFFIX
148138
- name: Upload packages to artifacts
149139
if: matrix.os == 'ubuntu-latest'
150140
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)