Files
SGU-CredentialProvider/scripts/Publish-Lab.ps1
T

45 lines
1.5 KiB
PowerShell

[CmdletBinding()]
param(
[string]$Configuration = 'Release',
[string]$OutputRoot = (Join-Path $PSScriptRoot '..\artifacts')
)
$ErrorActionPreference = 'Stop'
$repositoryRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
$dotnet = (Get-Command dotnet -ErrorAction Stop).Source
$brokerOutput = Join-Path $OutputRoot 'broker'
$providerOutput = Join-Path $OutputRoot 'credential-provider'
& $dotnet publish (Join-Path $repositoryRoot 'src\SGU.AuthBroker\SGU.AuthBroker.csproj') `
--configuration $Configuration `
--runtime win-x64 `
--self-contained true `
--output $brokerOutput
if ($LASTEXITCODE -ne 0) { throw 'Auth Broker publish failed.' }
& $dotnet publish (Join-Path $repositoryRoot 'src\SGU.CredentialProvider\SGU.CredentialProvider.csproj') `
--configuration $Configuration `
--runtime win-x64 `
--self-contained false `
--output $providerOutput
if ($LASTEXITCODE -ne 0) { throw 'Credential Provider publish failed.' }
$requiredProviderFiles = @(
'SGU.CredentialProvider.dll',
'SGU.CredentialProvider.comhost.dll',
'SGU.CredentialProvider.runtimeconfig.json',
'Lithnet.CredentialProvider.dll',
'SGU.AuthBroker.Core.dll'
)
foreach ($file in $requiredProviderFiles) {
if (-not (Test-Path -LiteralPath (Join-Path $providerOutput $file))) {
throw "Credential Provider output is missing $file."
}
}
[pscustomobject]@{
BrokerOutput = (Resolve-Path $brokerOutput).Path
CredentialProviderOutput = (Resolve-Path $providerOutput).Path
}