forked from AzureAD/SCIMReferenceCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script and nuspec file to publish file to our nuget server
- Loading branch information
1 parent
f2f74b2
commit d7b911b
Showing
2 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
$lastVersion = ""; | ||
|
||
$nuspecContent = Get-Content -Path ".\Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.nuspec" -raw | ||
|
||
|
||
$versionMatch = [regex]::Match($nuspecContent,'<version>(.*)</version>') | ||
|
||
if(!$versionMatch.Success) | ||
{ | ||
throw 'Previous version not found in nuspec file. Make sure it looks like this <version>x.x.x</version>' | ||
} | ||
|
||
$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,'<releaseNotes>.*</releaseNotes>') | ||
|
||
if(!$releaseNotesMatch.Success) | ||
{ | ||
throw 'release notes not found in nuspec file. Make sure it looks like this <releaseNotes>xxxxxxxx</releaseNotes>' | ||
} | ||
|
||
$lastReleaseNotesString = $releaseNotesMatch.Value | ||
|
||
Set-Content -Path ".\Microsoft.SystemForCrossDomainIdentityManagement\Microsoft.SCIM.nuspec" -Value $($nuspecContent -replace $("<version>$($lastVersionString)</version>"),$("<version>$($newVersion)</version>") -replace $lastReleaseNotesString,"<releaseNotes>$($releaseNotes)</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" |
32 changes: 32 additions & 0 deletions
32
Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.nuspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package > | ||
<metadata> | ||
<id>Evercate.Microsoft.Scim</id> | ||
<version>1.0.0</version> | ||
<title>Evercate scim based on Microsoft reference code</title> | ||
<authors>Evercate AB</authors> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>A direkt fork from Microsoft's reference scim code. Only neccesary updates will be done</description> | ||
<releaseNotes>initial release</releaseNotes> | ||
<copyright>Copyright 2020</copyright> | ||
<tags>microsoft evercate scim</tags> | ||
</metadata> | ||
</package> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|