Skip to content

Commit f98db1f

Browse files
authored
feat: net10 support
* feat: add .NET 10 support; replace MSBuild.exe with dotnet build * chore: point dotnet build at dotnet10-support branch for testing * fix: handle pre-registered Keyfactor NuGet source; add .NET 10 support
1 parent 025d384 commit f98db1f

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

.github/workflows/dotnet-build-and-release.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ jobs:
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
@@ -67,8 +65,29 @@ jobs:
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

.github/workflows/starter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
call-dotnet-build-and-release-workflow:
107107
needs: [ call-get-primary-language, call-assign-from-json-workflow, call-create-github-release-workflow ]
108108
if: needs.call-get-primary-language.outputs.primary_language == 'C#'
109-
uses: keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@v4
109+
uses: keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@dotnet10-support
110110
with:
111111
release_version: ${{ needs.call-create-github-release-workflow.outputs.release_version }}
112112
release_url: ${{ needs.call-create-github-release-workflow.outputs.release_url }}

0 commit comments

Comments
 (0)