@@ -13,55 +13,14 @@ jobs:
1313
1414 - name : Preparation
1515 run : |
16- # Get local uploaded manifest version of the package
17- $String = Get-Content -Path "Scripts\WinGet_Manifests\TeamSophia.SophiaScript.yaml" | Where-Object -FilterScript {$_ -match "ManifestVersion"}
18- $LocalManifest = $String -split " " | Select-Object -Last 1
19-
20- # Get latest supported manifest version provided
21- # https://github.com/microsoft/winget-cli/tree/master/schemas/JSON/manifests
22- $Parameters = @{
23- Uri = "https://api.github.com/repos/microsoft/winget-cli/contents/schemas/JSON/manifests"
24- UseBasicParsing = $true
25- Verbose = $true
26- }
27- $LatestManifest = ((Invoke-RestMethod @Parameters).name | Where-Object {($_ -ne "preview") -and ($_ -ne "latest")}) -replace ("v", "") | Sort-Object -Property {[System.Version]$_} | Select-Object -Last 1
28-
29- if ([System.Version]$LocalManifest -lt [System.Version]$LatestManifest)
30- {
31- Write-Warning -Message "A new manifest $($LatestManifest) available. Edit manifests in Scripts\WinGet_Manifests."
32- exit
33- }
34-
35- # Get latest version tag for Windows 11
36- $Parameters = @{
37- Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/sophia_script_versions.json"
38- UseBasicParsing = $true
39- }
40- $Version = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
41-
42- # Get archive hash
43- $Parameters = @{
44- Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$($Version)/Sophia.Script.for.Windows.11.v$($Version)_WinGet.exe"
45- UseBasicParsing = $true
46- }
47- $Request = (Invoke-WebRequest @Parameters).RawContentStream
48- $Hash = (Get-FileHash -InputStream $Request).Hash
49-
50- # Update the metadata for the files
51- Get-ChildItem -Path Scripts\WinGet_Manifests | ForEach-Object -Process {
52- (Get-Content -Path $_.FullName -Encoding UTF8 -Raw) | Foreach-Object -Process {
53- $_ -replace "SophiaScriptVersion", $Version `
54- -replace "SophiaScriptHash", $Hash `
55- -replace "SophiaScriptDate", $(Get-Date -Format "yyyy-MM-dd")
56- } | Set-Content -Path $_.FullName -Encoding utf8 -Force
57- }
16+ . "Scripts\WinGet.ps1"
5817
5918 - name : Publish to WinGet
6019 run : |
6120 # %LOCALAPPDATA%\Microsoft\WinGet\Packages
62-
6321 # Get the latest wingetcreate
6422 # https://github.com/microsoft/winget-create
23+ # https://github.com/microsoft/winget-pkgs/blob/master/Tools/YamlCreate.ps1
6524 $Parameters = @{
6625 Uri = "https://aka.ms/wingetcreate/latest"
6726 OutFile = "wingetcreate.exe"
0 commit comments