forked from steviecoaster/automaticpackages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUniversalLicensed.ps1
22 lines (16 loc) · 1.07 KB
/
UniversalLicensed.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[cmdletBinding()]
param(
[Parameter()]
[Version]
$DashboardVersion = $([string](Invoke-WebRequest -UseBasicParsing 'https://imsreleases.blob.core.windows.net/universal/production/version.txt')))
$currentVersion = choco list powershelluniversal --exact -r | ConvertFrom-CSV -Delimiter '|' -Header 'Name', 'Version'
if($null -eq $currentVersion) {
$currentVersion = [pscustomobject]@{'Version' = '0.0.0'}
}
if ([version]$($currentVersion.Version) -lt $DashboardVersion) {
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$Nuspec = Get-ChildItem $toolsDir -recurse -filter powershelluniversal.licensed.nuspec | Select-Object -ExpandProperty FullName
(Get-Content "$Nuspec").Replace('[[VERSION]]', "$DashboardVersion") | Set-Content "$Nuspec"
choco pack $Nuspec --output-directory="'$($env:Build_ArtifactStagingDirectory)'"
choco push $((Get-ChildItem $env:Build_ArtifactStagingDirectory -filter powershelluniversal.licensed.*.nupkg).FullName) -s https://push.chocolatey.org --api-key="'$env:ChocolateyKey'"
}