ci: update winget template + deploy for more info (#554)

Adds a `ProductCode`, `Scope`, and `Commands` field to the template, as well as additional changes to the deploy process to determine + fill in the `ProductCode` automatically.
This commit is contained in:
Clement Tsang 2021-07-21 19:02:00 -07:00 committed by GitHub
parent bcbdc15b51
commit 8aa1303b3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 1 deletions

View file

@ -267,6 +267,8 @@ jobs:
if: matrix.triple.target == 'x86_64-pc-windows-msvc'
run: |
python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/windows/winget/winget.yaml.template" "Clement.bottom.yaml" "SHA256" "./bottom_x86_64_installer.msi"
$Code = powershell ./deployment/windows/winget/get_product_code.ps1 ./bottom_x86_64_installer.msi
python "./deployment/windows/winget/product_code.py" Clement.bottom.yaml $Code
- name: Upload winget file (Windows x86-64 MSVC)
if: matrix.triple.target == 'x86_64-pc-windows-msvc'

View file

@ -0,0 +1,11 @@
$path = $args[0]
$comObjWI = New-Object -ComObject WindowsInstaller.Installer
$MSIDatabase = $comObjWI.GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$comObjWI,@($Path,0))
$Query = "SELECT Value FROM Property WHERE Property = 'ProductCode'"
$View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query))
$View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
$Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null)
$Value = $Record.GetType().InvokeMember("StringData","GetProperty",$null,$Record,1)
echo $Value

View file

@ -0,0 +1,20 @@
import sys
from string import Template
args = sys.argv
template_file_path = args[1]
product_code = args[2]
with open(template_file_path, "r") as template_file:
template = Template(template_file.read())
substitutes = dict()
substitutes["product_code"] = "'{}'".format(product_code)
substitute = template.safe_substitute(substitutes)
print("\n================== Generated package file ==================\n")
print(substitute)
print("\n============================================================\n")
with open(template_file_path, "w") as template_file:
template_file.write(substitute)

View file

@ -11,11 +11,15 @@ Tags:
- terminal
ShortDescription: Yet another cross-platform graphical process/system monitor.
PackageUrl: https://github.com/ClementTsang/bottom
Commands:
- btm
Installers:
- Architecture: x64
InstallerUrl: https://github.com/ClementTsang/bottom/releases/download/$version/bottom_x86_64_installer.msi
InstallerSha256: $hash1
ProductCode: $product_code
InstallerType: msi
Scope: machine
PackageLocale: en-US
ManifestType: singleton
ManifestVersion: 1.0.0