Skip to content

Commit b60d3aa

Browse files
committed
Add winget publishing
1 parent 18c98cd commit b60d3aa

4 files changed

Lines changed: 110 additions & 0 deletions

File tree

.github/workflows/winget.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Publish to WinGet
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish-winget:
8+
runs-on: windows-latest
9+
if: github.event.pull_request.merged == true
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '18.14.0'
19+
20+
- name: Install wingetcreate
21+
run: winget install --id Microsoft.WingetCreate --source winget --accept-package-agreements --accept-source-agreements
22+
23+
- name: Read version from winget manifest
24+
id: manifest_version
25+
shell: pwsh
26+
run: |
27+
$content = Get-Content "build/winget/manifest.yaml"
28+
$line = $content | Where-Object { $_ -match '^PackageVersion:\s*(.+)$' }
29+
if (-not $line) { throw "PackageVersion not found in manifest" }
30+
$version = $line -replace '^PackageVersion:\s*', ''
31+
$version = $version.Trim()
32+
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
33+
34+
- name: Compute SHA256 for the latest release
35+
id: hash
36+
shell: pwsh
37+
run: |
38+
$version = "${{ steps.manifest_version.outputs.version }}"
39+
$url = "https://github.com/${{ github.repository }}/releases/download/v$version/Owlet-$version-win-x64.exe"
40+
Write-Host "Downloading: $url"
41+
Invoke-WebRequest -Uri $url -OutFile installer.exe
42+
$hash = (Get-FileHash -Path installer.exe -Algorithm SHA256).Hash
43+
"sha256=$hash" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
44+
"url=$url" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
45+
46+
- name: Update winget manifest
47+
shell: pwsh
48+
run: |
49+
$version = "${{ steps.manifest_version.outputs.version }}"
50+
$hash = "${{ steps.hash.outputs.sha256 }}"
51+
$url = "${{ steps.hash.outputs.url }}"
52+
wingetcreate.exe update `
53+
--manifest "build/winget/manifest.yaml" `
54+
--url "$url" `
55+
--sha256 "$hash"
56+
57+
- name: Validate manifest
58+
shell: pwsh
59+
run: |
60+
wingetcreate.exe validate --path "build/winget/manifest.yaml"
61+
62+
- name: Submit manifest
63+
if: ${{ secrets.WINGET_TOKEN != '' }}
64+
shell: pwsh
65+
run: |
66+
wingetcreate.exe submit `
67+
--path "build/winget/manifest.yaml" `
68+
--token "${{ secrets.WINGET_TOKEN }}" `
69+
--silent

build/version-check.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const readmeFiles = [
1818
path.join(process.cwd(), `docs`, `README.pl.md`),
1919
path.join(process.cwd(), `docs`, `README.ru.md`),
2020
path.join(process.cwd(), `.github`, `ISSUE_TEMPLATE`, `bug-report.yml`),
21+
path.join(process.cwd(), `build`, `winget`, `manifest.yml`)
2122
];
2223

2324
readmeFiles.forEach((file) => {

build/version-update.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const readmeFiles = [
1616
path.join(process.cwd(), `docs`, `README.pl.md`),
1717
path.join(process.cwd(), `docs`, `README.ru.md`),
1818
path.join(process.cwd(), `.github`, `ISSUE_TEMPLATE`, `bug-report.yml`),
19+
path.join(process.cwd(), `build`, `winget`, `manifest.yml`)
1920
];
2021

2122
readmeFiles.forEach((file) => {

build/winget/manifest.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
PackageIdentifier: kashamalasha.Owlet
2+
PackageVersion: 0.8.2-beta
3+
DefaultLocale: en-US
4+
Publisher: kashamalasha
5+
PackageName: Owlet
6+
PublisherUrl: https://github.com/kashamalasha
7+
PackageUrl: https://github.com/kashamalasha/nightscout-widget-electron
8+
License: AGPL-3.0
9+
LicenseUrl: https://github.com/kashamalasha/nightscout-widget-electron/blob/main/LICENSE.md
10+
Copyright: Copyright © 2022 Dmitry Burnyshev
11+
CopyrightUrl: https://github.com/kashamalasha/nightscout-widget-electron
12+
Author: Dmitry Burnyshev
13+
AppMoniker: owlet
14+
Tags:
15+
- diabetes
16+
- glucose
17+
- cgm
18+
- nightscout
19+
- health
20+
- medical
21+
ShortDescription: A lightweight desktop widget for monitoring glucose levels through Nightscout.
22+
Description: Owlet is a cross-platform Electron widget application that displays sensor glucose values (SGV) from Nightscout API in real-time. Perfect for Type 1 Diabetes management with features like trend arrows, customizable alert levels, and always-on-top display.
23+
24+
Installers:
25+
- Type: exe
26+
Architecture: x64
27+
InstallModes:
28+
- silent
29+
Commands:
30+
- owlet
31+
32+
InstallerSwitches:
33+
Silent: /S
34+
35+
Repository: https://github.com/kashamalasha/nightscout-widget-electron
36+
InstallerSuccessCodes:
37+
- 0
38+
- 1641
39+
- 3010

0 commit comments

Comments
 (0)