You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
51 lines
1.9 KiB
name: WinGet push
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@main
|
|
|
|
- name: Preparation
|
|
run: |
|
|
# Get latest version tag for Windows 11
|
|
$Parameters = @{
|
|
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/sophia_script_versions.json"
|
|
UseBasicParsing = $true
|
|
}
|
|
$Version = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
|
|
|
|
# Get archive hash
|
|
$Parameters = @{
|
|
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$($Version)/Sophia.Script.for.Windows.11.v$($Version).zip"
|
|
UseBasicParsing = $true
|
|
}
|
|
$Request = (Invoke-WebRequest @Parameters).RawContentStream
|
|
$Hash = (Get-FileHash -InputStream $Request).Hash
|
|
|
|
# Update the metadata for the files
|
|
Get-ChildItem -Path Scripts\WinGet_Manifests | ForEach-Object -Process {
|
|
(Get-Content -Path $_.FullName -Encoding UTF8 -Raw) | Foreach-Object -Process {
|
|
$_ -replace "SophiaScriptVersion", $Version `
|
|
-replace "SophiaScriptHash", $Hash `
|
|
-replace "SophiaScriptDate", $(Get-Date -Format "yyyy-MM-dd")
|
|
} | Set-Content -Path $_.FullName -Encoding utf8 -Force
|
|
}
|
|
|
|
- name: Publish to WinGet
|
|
run: |
|
|
# Get the latest wingetcreate
|
|
# https://github.com/microsoft/winget-create
|
|
$Parameters = @{
|
|
Uri = "https://aka.ms/wingetcreate/latest"
|
|
OutFile = "wingetcreate.exe"
|
|
UseBasicParsing = $true
|
|
}
|
|
Invoke-WebRequest @Parameters
|
|
|
|
.\wingetcreate.exe submit --prtitle "New Version: TeamSophia.SophiaScript version $Version" --token "${{ secrets.WINGET_PAT }}" "Scripts\WinGet_Manifests"
|
|
|