From d7b911b59c8bc94ad8b3d440a7bd2b4d6b8a8c8c Mon Sep 17 00:00:00 2001 From: Rickard Liljeberg Date: Tue, 10 Nov 2020 19:32:43 +0100 Subject: [PATCH] script and nuspec file to publish file to our nuget server --- BuildAndUploadLibrary.ps1 | 94 +++++++++++++++++++ .../Microsoft.SCIM.nuspec | 32 +++++++ 2 files changed, 126 insertions(+) create mode 100644 BuildAndUploadLibrary.ps1 create mode 100644 Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.nuspec diff --git a/BuildAndUploadLibrary.ps1 b/BuildAndUploadLibrary.ps1 new file mode 100644 index 00000000..ccb65d66 --- /dev/null +++ b/BuildAndUploadLibrary.ps1 @@ -0,0 +1,94 @@ +$lastVersion = ""; + +$nuspecContent = Get-Content -Path ".\Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.nuspec" -raw + + +$versionMatch = [regex]::Match($nuspecContent,'(.*)') + +if(!$versionMatch.Success) +{ + throw 'Previous version not found in nuspec file. Make sure it looks like this x.x.x' +} + +$lastVersionString = $versionMatch.Groups[1].Value + +try{ + + $lastVersion = [version]($lastVersionString) + +} +catch { + Write-Host $_ -BackgroundColor Black -ForegroundColor Red + Write-Host "Incorrect format of version in nuspec file" + Read-Host -Prompt "Enter to exit" + exit +} + +$automaticVersionToUse = "1.0.0" +if(![string]::IsNullOrEmpty($lastVersion)) +{ + $automaticVersionToUse = "{0}.{1}.{2}" -f $lastVersion.Major, $lastVersion.Minor, ($lastVersion.Build + 1) +} + +$manualVersion = Read-Host -Prompt "OPTIONAL: Manual version number (Press enter for automatic - $automaticVersionToUse)" + +$newVersion = $automaticVersionToUse; +if(![string]::IsNullOrEmpty($manualVersion)) +{ + try{ + $splitManual = [System.Version]::Parse($manualVersion) + } + catch { + Write-Host $_ -BackgroundColor Black -ForegroundColor Red + Write-Host "Incorrect format of given version - Should have format Major.Minor.Build so for instance 1.0.2" + Read-Host -Prompt "Enter to exit" + exit + } + $newVersion = $manualVersion; +} + + +$releaseNotes = Read-Host -Prompt "Release notes" + +$releaseNotesMatch = [regex]::Match($nuspecContent,'.*') + +if(!$releaseNotesMatch.Success) +{ + throw 'release notes not found in nuspec file. Make sure it looks like this xxxxxxxx' +} + +$lastReleaseNotesString = $releaseNotesMatch.Value + +Set-Content -Path ".\Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.nuspec" -Value $($nuspecContent -replace $("$($lastVersionString)"),$("$($newVersion)") -replace $lastReleaseNotesString,"$($releaseNotes)") + +dotnet build ".\Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.csproj" --configuration Release -p:Version=$newVersion + +..\nuget.exe pack .\Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.csproj -Properties Configuration=Release + +Write-Host "Press enter to push to nuget server (or close to not push)" -BackgroundColor Black -ForegroundColor Cyan +Read-Host + +$nugetApiKey = "" + +if([System.IO.File]::Exists(".\NugetKey.txt")) +{ + $nugetApiKey = Get-Content -Path .\NugetKey.txt -First 1 +} +else +{ + Write-Host $_ -BackgroundColor Black -ForegroundColor Red + Write-Host "There must be a NugetKey.txt in the same directory as this build script that contains only the api key to the nuget server" + Read-Host -Prompt "Enter to exit" + exit +} + +$packages = gci ".\*.nupkg" +foreach ($package in $packages){ + $packageLocation = ".\" + $package.Name + ..\nuget.exe push $packageLocation $nugetApiKey -Source http://nuget.evercate.com/nuget + + Remove-Item –path $packageLocation +} + + +Read-Host -Prompt "Enter to exit" \ No newline at end of file diff --git a/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.nuspec b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.nuspec new file mode 100644 index 00000000..7e36b4f3 --- /dev/null +++ b/Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.nuspec @@ -0,0 +1,32 @@ + + + + Evercate.Microsoft.Scim + 1.0.0 + Evercate scim based on Microsoft reference code + Evercate AB + false + A direkt fork from Microsoft's reference scim code. Only neccesary updates will be done + initial release + Copyright 2020 + microsoft evercate scim + + + + + + + + + + + + + + + + + + + +