-
Notifications
You must be signed in to change notification settings - Fork 19
66 lines (56 loc) · 2.04 KB
/
Copy pathwinget.yml
File metadata and controls
66 lines (56 loc) · 2.04 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Publish to WinGet
on:
workflow_dispatch:
jobs:
publish-winget:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install wingetcreate
run: |
winget install `
--id Microsoft.WingetCreate `
--source winget `
--accept-package-agreements `
--accept-source-agreements `
--silent | Out-Null
- name: Read the install path from the installer manifest
id: install_path
shell: pwsh
run: |
$path = "build/winget/kashamalasha.Owlet.installer.yaml"
$content = Get-Content $path
$line = $content | Where-Object { $_ -match '^\s*InstallerUrl:\s*(.+)$' }
if (-not $line) { throw "InstallerUrl not found in manifest" }
$url = $line -replace '^\s*InstallerUrl:\s*', ''
$url = $url.Trim()
"installUrl=$url" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Compute SHA256 for the latest release
id: hash
shell: pwsh
run: |
$url = "${{ steps.install_path.outputs.installUrl }}"
Write-Host "Downloading: $url"
Invoke-WebRequest -Uri $url -OutFile installer.exe
$hash = (Get-FileHash -Path installer.exe -Algorithm SHA256).Hash
"sha256=$hash" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Patch WinGet installer manifest
shell: pwsh
run: |
$path = "build/winget/kashamalasha.Owlet.installer.yaml"
$hash = "${{ steps.hash.outputs.sha256 }}"
$content = Get-Content $path
$content = $content -replace '(?m)^(\s*InstallerSha256:\s*).+$', "`$1$hash"
Set-Content -Path $path -Value $content
- name: Validate manifest
shell: pwsh
run: |
winget validate `
--manifest "build/winget"
- name: Submit manifest
shell: pwsh
env:
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
run: |
wingetcreate submit build/winget