Deploy.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
$functionFile = Get-Content *.psm1 if (($functionFile -match "^function ").Count -eq 0) { write-host -BackgroundColor red NO FUNCTIONS AVAILABLE } $specFunctions = ($functionFile -match "^function ").Replace("function","").Replace("Function","").Replace("{","").Replace("(","").Replace(")","").Trim() $replaceFunctions = "FunctionsToExport = @('"+($specFunctions -join "','")+"')" $file = Get-ChildItem *.psd1 $specFile = Get-Content $file.Name $specFile = $specFile -replace "FunctionsToExport(.*)",$replaceFunctions #write specFile Set-Content -Path $file.Name -Value $specFile $nuspecfile = Get-ChildItem *.nuspec if (-not $nuspecfile) { Write-host -BackgroundColor red NUSPEC file not AVAILABLE nuget spec ($file.Name.split('.'))[0] throw 'nuspec was not found. please update before rerun' } $xml = [xml](Get-Content $nuspecfile) $xml.SelectNodes("//version") | % { write-host tes is $_."#text" $oldVersion = $_."#text" $numbers = $_."#text".Split("."); $numbers[2] = [int]$numbers[2] += 1 $_."#text" = $numbers -join '.' } $xml.Save(((Get-location).Path+ "/" +$nuspecfile.Name)) write-host Replacing psd $filePSD = Get-ChildItem *.psd1 (get-content $filePSD).replace($oldVersion ,$numbers -join '.') | Out-file -FilePath $filePSD -Force Remove-Item *.nupkg nuget pack $nuspecfile $filePackage = Get-ChildItem *.nupkg #nuget push -Source "nuget.org" -ApiKey oy2ipnyjfhwklixog7pqjh3fchttciguxptqspvxwqw5oy ($filePackage.FullName) $publishParam = @{ Path = ".\" NuGetApiKey = "oy2iwmjj7tlfwgknugjaz5tqaugzja6erf3feu2tidlkye" Force = $true } Publish-Module @publishParam #Save-Module -Name Ublion-Topbakkers -Repository LeftPowershell -Path '.' #Publish-Module -Path 'C:\Users\Sascha Greven\Documents\Tobakkers\Ublion-Topbakkers' -Repository LeftPowershell -NuGetApiKey yfxh774wuu37u4e3v7z7xun3xk24petl6cjcobkv44zp5s5u2pqa |