Created
October 6, 2021 17:10
-
-
Save jedieaston/3b07c5f2fd201bee81fd0a3024d74fdf to your computer and use it in GitHub Desktop.
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
$errorActionPreference = "Stop" | |
$products = @( | |
@{ | |
manifestId = "JetBrains.PyCharm.Community"; | |
jetbrainsId = "PCC"; | |
}, | |
@{ | |
manifestId = "JetBrains.PyCharm.Professional"; | |
jetbrainsId = "PCP"; | |
}, | |
@{ | |
manifestId = "JetBrains.IntelliJIDEA.Community"; | |
jetbrainsId = "IIC"; | |
}, | |
@{ | |
manifestId = "JetBrains.IntelliJIDEA.Ultimate"; | |
jetbrainsId = "IIU"; | |
}, | |
@{ | |
manifestId = "JetBrains.GoLand"; | |
jetbrainsId = "GO"; | |
}, | |
@{ | |
manifestId = "JetBrains.RubyMine"; | |
jetbrainsId = "RM"; | |
}, | |
@{ | |
manifestId = "JetBrains.PHPStorm"; | |
jetbrainsId = "PS"; | |
}, | |
@{ | |
manifestId = "JetBrains.DataGrip"; | |
jetbrainsId = "DG"; | |
}, | |
@{ | |
manifestId = "JetBrains.WebStorm"; | |
jetbrainsId = "WS"; | |
} | |
@{ | |
manifestId = "JetBrains.CLion"; | |
jetbrainsId = "CL"; | |
}, | |
@{ | |
manifestId = "JetBrains.IntelliJIDEA.Edu"; | |
jetbrainsId = "IIE" | |
}, | |
@{ | |
manifestId = "JetBrains.Rider"; | |
jetbrainsId = "RD"; | |
}, | |
@{ | |
manifestId = "JetBrains.ReSharper"; | |
jetbrainsId = "RS" | |
}, | |
@{ | |
manifestId = "JetBrains.dotUltimate"; | |
jetbrainsId = "RS" | |
} | |
) | |
$repoRoot = "C:\Users\easton\projects\winget-pkgs" | |
$startingPlace = (Get-Location) | |
$ProgressPreference = "SilentlyContinue" | |
$currentReleases = Invoke-WebRequest "https://data.services.jetbrains.com/products?release.type=release" | ConvertFrom-Json | |
foreach($i in $products) { | |
Write-Host "Checking " $i["manifestId"] "..." -ForegroundColor Yellow | |
Set-Location $repoRoot | |
$splitId = $i["manifestId"].Split(".") | |
$path = "" | |
foreach($j in $splitId) { | |
$path += $j + "\" | |
} | |
Set-Location (".\manifests\j\" + $path) | |
$jetbrainsProduct = $null | |
foreach ($j in $currentReleases) { | |
if ($j.code -eq $i.jetbrainsId) { | |
$jetbrainsProduct = $j | |
break; | |
} | |
} | |
if ($null -eq $jetbrainsProduct) { | |
Write-Host "Couldn't find product data for " $i.manifestId ", skipping." | |
continue | |
} | |
if ($null -eq $jetbrainsProduct.releases[0].build) { | |
if ($i["jetbrainsId"] -eq "RS") { | |
$newVersion = $jetbrainsProduct.releases[0].version | |
$installerUrl = $jetbrainsProduct.releases[0].downloads.windowsWeb.link | |
} | |
else { | |
Write-Host "Couldn't find product data for " $i.manifestId ", skipping." | |
continue | |
} | |
} | |
else { | |
$newVersion = $jetbrainsProduct.releases[0].build | |
$installerUrl = $jetbrainsProduct.releases[0].downloads.windows.link | |
} | |
$current = (Get-WinGetApplicationCurrentVersion $i["manifestId"]) | |
if (-Not (Test-Path (".\" + $newVersion + "\"))) { | |
git show-ref --verify --quiet ("refs/heads/" + $i["manifestId"] + "-" + $newVersion) | Out-Null | |
if ($LASTEXITCODE -eq 0) { | |
Write-Host $i["manifestId"] "is not up to date, but you already have a branch for it. Skipping..." -ForegroundColor Yellow | |
continue; | |
} | |
Write-Host "Found an update for " $i.manifestId "to build " $newVersion "..." -ForegroundColor Yellow | |
if(Update-WinGetManifest (".\" + $current + "\") $newVersion -newUrl $installerUrl) { | |
New-WinGetCommit $newVersion | |
git push -u origin | |
qpr | |
Write-Host "Update complete!" -ForegroundColor Green | |
} | |
} | |
else { | |
Write-Host $i.manifestId is up to date! -ForegroundColor Green | |
} | |
# Set-Location $repoRoot | |
} | |
Write-Host "All done!" -ForegroundColor Green | |
Set-Location $startingPlace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment