This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
UpdateScript.ps1
47 lines (37 loc) · 1.6 KB
/
UpdateScript.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
$orignalProtocol = [System.Net.ServicePointManager]::SecurityProtocol
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
Write-Host "Updateing all Packages" -ForegroundColor Yellow
Write-Host
Write-Host
$updatedPackages = Update-AllGTCPackage
$GTCProfile = Read-GTCProfile
$CurrentLocation = Get-Location
foreach ($packageName in $updatedPackages)
{
Write-Host
Write-Host
Write-Host "Pushing Package $packageName" -ForegroundColor Magenta
# gether info
$package = $GTCProfile.$packageName
$newVersion = $package.version
$packageDir = $package.packagePath
$newVersionDir = "$packageDir\Versions\$newVersion"
# go to new version path
Set-Location -Path $newVersionDir
# pack and push to choco
Write-Host 'packing and pushing to choco' -ForegroundColor Yellow
Write-Host
Start-Process -FilePath "choco.exe" -ArgumentList "pack" -Wait -NoNewWindow
Start-Process -FilePath "choco.exe" -ArgumentList "push" -Wait -NoNewWindow
# add and commit to git
Write-Host 'updating git' -ForegroundColor Yellow
Write-Host
Set-Location $packageDir
Start-Process -FilePath "git.exe" -ArgumentList "add ." -Wait -NoNewWindow
Start-Process -FilePath 'git.exe' -ArgumentList "commit -m `"update $packageName to $newVersion`"" -Wait -NoNewWindow
}
Write-Host 'pushing everything to git'
Start-Process -FilePath 'git.exe' -ArgumentList "pull origin master" -Wait -NoNewWindow
Start-Process -FilePath 'git.exe' -ArgumentList 'push origin master' -Wait -NoNewWindow
Set-Location -Path $CurrentLocation
[System.Net.ServicePointManager]::SecurityProtocol = $orignalProtocol