4242 3.1.x
4343 6.0.x
4444 8.0.x
45-
46- - name : Setup MSBuild
47- uses : keyfactor/setup-msbuild@v2
45+ 10.0.x
4846
4947 - name : Setup build environment
5048 id : setup_env
6765 echo "Pre-release flagged: $($isPreRelease)"
6866 echo "IS_PRE_RELEASE=$($isPreRelease)" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
6967
70- dotnet nuget add source https://nuget.pkg.github.com/Keyfactor/index.json -n github -u ${{ github.actor }} -p ${{ secrets.token }} --store-password-in-clear-text
71- nuget restore $slnPath -Project2ProjectTimeout 240
68+ # Register the Keyfactor NuGet feed with credentials.
69+ # If the source URL is already registered (e.g. via a repo nuget.config),
70+ # find its name and update credentials rather than failing.
71+ $addOutput = dotnet nuget add source https://nuget.pkg.github.com/Keyfactor/index.json `
72+ -n keyfactor -u ${{ github.actor }} -p ${{ secrets.token }} --store-password-in-clear-text 2>&1
73+ if ($LASTEXITCODE -ne 0) {
74+ Write-Host "Source already registered; finding name to update credentials..."
75+ $lines = dotnet nuget list source
76+ $sourceName = $null
77+ for ($i = 0; $i -lt $lines.Count; $i++) {
78+ if ($lines[$i] -match 'nuget\.pkg\.github\.com/Keyfactor') {
79+ if ($lines[$i-1] -match '^\s+\d+\.\s+(\S+)') { $sourceName = $Matches[1] }
80+ }
81+ }
82+ if ($sourceName) {
83+ dotnet nuget update source $sourceName -u ${{ github.actor }} -p ${{ secrets.token }} --store-password-in-clear-text
84+ } else {
85+ Write-Error "Could not locate Keyfactor NuGet source to update credentials."
86+ exit 1
87+ }
88+ }
89+
90+ dotnet restore $slnPath
7291
7392 - name : Increment Assembly Version
7493 if : env.CREATE_RELEASE == 'True'
@@ -88,10 +107,10 @@ jobs:
88107 }
89108 }
90109
91- - name : Execute MSBuild Commands
110+ - name : Execute dotnet build
92111 run : |
93112 $newVer = "${{ inputs.release_version || '1.0.0' }}".TrimStart('v').Split('-')[0]
94- MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=false -p:Configuration= Release -p:Version=$newVer
113+ dotnet build $Env:SOLUTION_PATH --no-restore -c Release -p:Version=$newVer
95114
96115 - name : Read Target Frameworks
97116 id : read_target_frameworks
0 commit comments