Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions .github/workflows/dotnet-build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ jobs:
3.1.x
6.0.x
8.0.x

- name: Setup MSBuild
uses: keyfactor/setup-msbuild@v2
10.0.x

- name: Setup build environment
id: setup_env
Expand All @@ -67,8 +65,29 @@ jobs:
echo "Pre-release flagged: $($isPreRelease)"
echo "IS_PRE_RELEASE=$($isPreRelease)" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append

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
nuget restore $slnPath -Project2ProjectTimeout 240
# Register the Keyfactor NuGet feed with credentials.
# If the source URL is already registered (e.g. via a repo nuget.config),
# find its name and update credentials rather than failing.
$addOutput = dotnet nuget add source https://nuget.pkg.github.com/Keyfactor/index.json `
-n keyfactor -u ${{ github.actor }} -p ${{ secrets.token }} --store-password-in-clear-text 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "Source already registered; finding name to update credentials..."
$lines = dotnet nuget list source
$sourceName = $null
for ($i = 0; $i -lt $lines.Count; $i++) {
if ($lines[$i] -match 'nuget\.pkg\.github\.com/Keyfactor') {
if ($lines[$i-1] -match '^\s+\d+\.\s+(\S+)') { $sourceName = $Matches[1] }
}
}
if ($sourceName) {
dotnet nuget update source $sourceName -u ${{ github.actor }} -p ${{ secrets.token }} --store-password-in-clear-text
} else {
Write-Error "Could not locate Keyfactor NuGet source to update credentials."
exit 1
}
}

dotnet restore $slnPath

- name: Increment Assembly Version
if: env.CREATE_RELEASE == 'True'
Expand All @@ -88,10 +107,10 @@ jobs:
}
}

- name: Execute MSBuild Commands
- name: Execute dotnet build
run: |
$newVer = "${{ inputs.release_version || '1.0.0' }}".TrimStart('v').Split('-')[0]
MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=false -p:Configuration=Release -p:Version=$newVer
dotnet build $Env:SOLUTION_PATH --no-restore -c Release -p:Version=$newVer

- name: Read Target Frameworks
id: read_target_frameworks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
call-dotnet-build-and-release-workflow:
needs: [ call-get-primary-language, call-assign-from-json-workflow, call-create-github-release-workflow ]
if: needs.call-get-primary-language.outputs.primary_language == 'C#'
uses: keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@v4
uses: keyfactor/actions/.github/workflows/dotnet-build-and-release.yml@dotnet10-support
with:
release_version: ${{ needs.call-create-github-release-workflow.outputs.release_version }}
release_url: ${{ needs.call-create-github-release-workflow.outputs.release_url }}
Expand Down
Loading