lablup / lablup/all-smi

Register all-smi to WinGet (Windows Package Manager)

Open
#101 0 comments 0 reactions 1 assignee Claimed by @inureyes View on GitHub
area:ci priority:medium status:ready type:enhancement
Dominant language
Rust
Stars
279
Forks
28
Avg merge
8h 35m
Merged PRs (30d)
30

Description

## Problem / Background

Windows users currently need to manually download and install all-smi from GitHub releases. Registering the package with WinGet (Windows Package Manager) will enable users to install via a simple command:

```powershell
winget install all-smi
```

This aligns with our distribution strategy for other platforms (Ubuntu PPA, Homebrew consideration) and improves discoverability for Windows users.

## Proposed Solution

Submit all-smi to the [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) repository by creating the required manifest files and opening a pull request.

### Package Information

| Field | Value |
|-------|-------|
| PackageIdentifier | `Lablup.AllSmi` |
| PackageVersion | `0.14.0` |
| Moniker | `all-smi` |
| Publisher | Lablup Inc. |
| License | Apache-2.0 |
| Homepage | https://github.com/lablup/all-smi |
| InstallerUrl | `https://github.com/lablup/all-smi/releases/download/v{version}/all-smi-windows-x86_64.zip` |

## Implementation Steps

### 1. Fork and Clone winget-pkgs Repository

```bash
gh repo fork microsoft/winget-pkgs --clone
cd winget-pkgs
```

### 2. Create Manifest Directory Structure

```
manifests/
l/
Lablup/
AllSmi/
0.14.0/
Lablup.AllSmi.yaml # Version manifest
Lablup.AllSmi.installer.yaml # Installer manifest
Lablup.AllSmi.locale.en-US.yaml # Locale manifest (default)
```

### 3. Create Version Manifest (`Lablup.AllSmi.yaml`)

```yaml
PackageIdentifier: Lablup.AllSmi
PackageVersion: 0.14.0
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.6.0
```

### 4. Create Installer Manifest (`Lablup.AllSmi.installer.yaml`)

```yaml
PackageIdentifier: Lablup.AllSmi
PackageVersion: 0.14.0
Platform:
- Windows.Desktop
MinimumOSVersion: 10.0.0.0
InstallerType: zip
NestedInstallerType: portable
NestedInstallerFiles:
- RelativeFilePath: all-smi.exe
PortableCommandAlias: all-smi
Installers:
- Architecture: x64
InstallerUrl: https://github.com/lablup/all-smi/releases/download/v0.14.0/all-smi-windows-x86_64.zip
InstallerSha256:
ManifestType: installer
ManifestVersion: 1.6.0
```

**Note:** The SHA256 hash should be obtained from the `.sha256` file in the release or computed locally:
```powershell
(Get-FileHash -Algorithm SHA256 all-smi-windows-x86_64.zip).Hash
```

### 5. Create Locale Manifest (`Lablup.AllSmi.locale.en-US.yaml`)

```yaml
PackageIdentifier: Lablup.AllSmi
PackageVersion: 0.14.0
PackageLocale: en-US
Publisher: Lablup Inc.
PublisherUrl: https://www.lablup.com
PublisherSupportUrl: https://github.com/lablup/all-smi/issues
PackageName: all-smi
PackageUrl: https://github.com/lablup/all-smi
License: Apache-2.0
LicenseUrl: https://github.com/lablup/all-smi/blob/main/LICENSE
ShortDescription: Command-line utility for monitoring GPU hardware
Description: |-
all-smi is a unified command-line utility for monitoring GPU and AI accelerator hardware.
It provides real-time metrics including utilization, memory usage, temperature, and power consumption.
Supports NVIDIA GPUs, Apple Silicon, Intel Gaudi, AMD GPUs, and various NPU platforms.
Tags:
- gpu
- nvidia
- monitoring
- hardware
- cli
- gpu-monitor
- nvidia-smi
- system-monitor
Moniker: all-smi
ManifestType: defaultLocale
ManifestVersion: 1.6.0
```

### 6. Validate Manifests

```powershell
# Install winget-create tool
winget install wingetcreate

# Validate manifests
winget validate --manifest manifests/l/Lablup/AllSmi/0.14.0/
```

### 7. Test Installation Locally

```powershell
winget install --manifest manifests/l/Lablup/AllSmi/0.14.0/
```

### 8. Submit Pull Request

Create a PR to microsoft/winget-pkgs with:
- Title: `New package: Lablup.AllSmi version 0.14.0`
- Description explaining the package and its purpose
- Ensure all automated checks pass

## GitHub Action Automation for WinGet PR

This section provides a complete setup for automatically creating WinGet pull requests when new releases are published.

### Prerequisites

1. **Fork microsoft/winget-pkgs** - Required for creating PRs
2. **Create GitHub Personal Access Token (PAT)**:
- Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Token name: `WINGET_TOKEN`
- Repository access: Select `microsoft/winget-pkgs` (your fork)
- Permissions required:
- Contents: Read and write
- Pull requests: Read and write
- Metadata: Read-only

3. **Add Secret to Repository**:
- Go to lablup/all-smi → Settings → Secrets and variables → Actions
- Add new secret: `WINGET_TOKEN` with your PAT value

### GitHub Action Workflow

Create `.github/workflows/winget-publish.yml`:

```yaml
name: Publish to WinGet

on:
release:
types: [published]

jobs:
publish:
# Only run on non-prerelease Windows releases
if: ${{ !github.event.release.prerelease }}

runs-on: windows-latest

steps:
- name: Publish to WinGet
uses: vedantmgoyal9/winget-releaser@v2
with:
# Package identifier in WinGet
identifier: Lablup.AllSmi

# Regex to match the Windows installer asset
installers-regex: 'all-smi-windows-x86_64\.zip$'

# GitHub PAT with access to fork winget-pkgs and create PRs
token: ${{ secrets.WINGET_TOKEN }}
```

### How It Works

1. **Trigger**: When a new release is published on GitHub
2. **Asset Detection**: Finds `all-smi-windows-x86_64.zip` using the regex pattern
3. **Hash Calculation**: Automatically downloads and computes SHA256 hash
4. **Manifest Generation**: Creates/updates manifest files in winget-pkgs fork
5. **PR Creation**: Opens a pull request to microsoft/winget-pkgs

### Workflow Features

| Feature | Description |
|---------|-------------|
| Auto version detection | Extracts version from release tag (e.g., `v0.14.0` → `0.14.0`) |
| SHA256 auto-calculation | Downloads asset and computes hash automatically |
| Existing version check | Skips if version already exists in winget-pkgs |
| PR auto-formatting | Follows microsoft/winget-pkgs PR conventions |

### Advanced Configuration

For more control, use the extended configuration with manual trigger support:

```yaml
name: Publish to WinGet

on:
release:
types: [published]
workflow_dispatch:
inputs:
release-tag:
description: 'Release tag to publish (e.g., v0.15.0)'
required: true
type: string

jobs:
publish:
if: ${{ !github.event.release.prerelease || github.event_name == 'workflow_dispatch' }}
runs-on: windows-latest

steps:
- name: Publish to WinGet
uses: vedantmgoyal9/winget-releaser@v2
with:
identifier: Lablup.AllSmi
installers-regex: 'all-smi-windows-x86_64\.zip$'
token: ${{ secrets.WINGET_TOKEN }}
release-tag: ${{ inputs.release-tag || github.event.release.tag_name }}
```

### Manual Trigger Support

The `workflow_dispatch` event allows manual triggering from GitHub Actions UI:

1. Go to Actions → "Publish to WinGet"
2. Click "Run workflow"
3. Enter the release tag (e.g., `v0.15.0`)
4. Click "Run workflow"

This is useful for:
- Retrying failed submissions
- Publishing older versions
- Testing the workflow

### Troubleshooting

| Issue | Solution |
|-------|----------|
| "Resource not accessible by integration" | PAT lacks required permissions. Regenerate with correct scopes. |
| "Version already exists" | Normal - package version already in winget-pkgs |
| "No matching assets found" | Check `installers-regex` matches your release asset name |
| PR validation fails | Check manifest schema version and required fields |

### Monitoring

After setup, monitor the workflow:
1. GitHub Actions tab shows workflow runs
2. Check winget-pkgs fork for created branches
3. Monitor [microsoft/winget-pkgs PRs](https://github.com/microsoft/winget-pkgs/pulls?q=is%3Apr+Lablup) for your submissions

## Acceptance Criteria

- [ ] Create manifest files following WinGet manifest schema v1.6.0
- [ ] Validate manifests using `winget validate`
- [ ] Test local installation with `winget install --manifest`
- [ ] Submit PR to microsoft/winget-pkgs repository
- [ ] PR passes all automated validation checks
- [ ] Package is searchable via `winget search all-smi` after merge
- [ ] Set up GitHub Action for automated WinGet PR creation
- [ ] Add `WINGET_TOKEN` secret to repository

## First-Time Setup Checklist

- [ ] Fork microsoft/winget-pkgs repository
- [ ] Create GitHub PAT with required permissions
- [ ] Add `WINGET_TOKEN` secret to lablup/all-smi repository
- [ ] Create `.github/workflows/winget-publish.yml`
- [ ] Initial manual submission to establish package in winget-pkgs
- [ ] Test automation with next release

## Technical Considerations

### Portable vs Installer

We are using the **portable** installation type (zip extraction) since:
- Our release is a standalone executable in a zip file
- No registry entries or complex installation required
- Simpler maintenance and updates

### InstallerType Details

For zip files containing a portable executable:
- `InstallerType: zip` - indicates the package is distributed as a zip file
- `NestedInstallerType: portable` - indicates the zip contains a portable app
- `NestedInstallerFiles` - specifies the executable path within the zip

### SHA256 Hash Management

Each version update requires:
1. Computing SHA256 of the new zip file
2. Updating the installer manifest with the new hash

With the GitHub Action automation, this is handled automatically.

## Additional Context

- [WinGet Package Manifest Documentation](https://learn.microsoft.com/en-us/windows/package-manager/package/manifest)
- [WinGet CLI Repository](https://github.com/microsoft/winget-cli)
- [WinGet Packages Repository](https://github.com/microsoft/winget-pkgs)
- [vedantmgoyal9/winget-releaser](https://github.com/vedantmgoyal9/winget-releaser) - GitHub Action for WinGet
- [Example Portable Package](https://github.com/microsoft/winget-pkgs/tree/master/manifests/r/Rustlang/Rustup)
- Related: #97 (Add Windows x64 build target)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.