Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions .github/workflows/release-jtk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,34 @@ jobs:
$tag = "jtk-v$version"
gh release download $tag --pattern "checksums.txt" --dir artifacts

- name: Extract checksums
- name: Prepare winget manifests
run: |
$version = "${{ needs.goreleaser.outputs.version }}"
$checksums = Get-Content artifacts/checksums.txt
$amd64 = ($checksums | Select-String "jtk_${version}_windows_amd64.zip").ToString().Split(" ")[0]
$arm64 = ($checksums | Select-String "jtk_${version}_windows_arm64.zip").ToString().Split(" ")[0]
echo "CHECKSUM_AMD64=$amd64" >> $env:GITHUB_ENV
echo "CHECKSUM_ARM64=$arm64" >> $env:GITHUB_ENV

# Copy templates to working directory
New-Item -ItemType Directory -Path manifests -Force
Copy-Item tools/jtk/packaging/winget/*.yaml manifests/

# Replace version placeholder in all manifest files
Get-ChildItem manifests/*.yaml | ForEach-Object {
$content = Get-Content $_.FullName -Raw
$content = $content -replace '0\.0\.0', $version
Set-Content $_.FullName $content -NoNewline
}

# Set checksums in installer manifest (uses distinct placeholders)
$installer = Get-Content manifests/OpenCLICollective.jira-ticket-cli.installer.yaml -Raw
$installer = $installer -replace 'CHECKSUM_AMD64_PLACEHOLDER', $amd64
$installer = $installer -replace 'CHECKSUM_ARM64_PLACEHOLDER', $arm64
Set-Content manifests/OpenCLICollective.jira-ticket-cli.installer.yaml $installer -NoNewline

- name: Install wingetcreate
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe

- name: Update and submit manifest
- name: Submit manifests
run: |
$version = "${{ needs.goreleaser.outputs.version }}"
$baseUrl = "https://github.com/open-cli-collective/atlassian-cli/releases/download/jtk-v$version"

./wingetcreate.exe update OpenCLICollective.jira-ticket-cli `
--version $version `
--urls "$baseUrl/jtk_${version}_windows_amd64.zip|x64" "$baseUrl/jtk_${version}_windows_arm64.zip|arm64" `
--submit `
--token ${{ secrets.WINGET_GITHUB_TOKEN }}
./wingetcreate.exe submit --path manifests --token ${{ secrets.WINGET_GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/test-winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ jobs:
# Installer manifest
$content = Get-Content "tools/jtk/packaging/winget/OpenCLICollective.jira-ticket-cli.installer.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
$regex = [regex]"0{64}"
$content = $regex.Replace($content, $testHash1, 1)
$content = $regex.Replace($content, $testHash2, 1)
$content = $content -replace 'CHECKSUM_AMD64_PLACEHOLDER', $testHash1
$content = $content -replace 'CHECKSUM_ARM64_PLACEHOLDER', $testHash2
Set-Content "$testDir/OpenCLICollective.jira-ticket-cli.installer.yaml" $content -Encoding UTF8

Write-Host "Validating jtk winget manifest..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ NestedInstallerFiles:
Installers:
- Architecture: x64
InstallerUrl: https://github.com/open-cli-collective/atlassian-cli/releases/download/jtk-v0.0.0/jtk_0.0.0_windows_amd64.zip
InstallerSha256: 0000000000000000000000000000000000000000000000000000000000000000
InstallerSha256: CHECKSUM_AMD64_PLACEHOLDER
- Architecture: arm64
InstallerUrl: https://github.com/open-cli-collective/atlassian-cli/releases/download/jtk-v0.0.0/jtk_0.0.0_windows_arm64.zip
InstallerSha256: 0000000000000000000000000000000000000000000000000000000000000000
InstallerSha256: CHECKSUM_ARM64_PLACEHOLDER
ManifestType: installer
ManifestVersion: 1.10.0
48 changes: 23 additions & 25 deletions tools/jtk/packaging/winget/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Winget Package for jira-ticket-cli

This directory contains the Winget manifest templates for distributing jira-ticket-cli on Windows via `winget install OpenCLICollective.jira-ticket-cli`.
This directory contains the Winget manifest templates for distributing jtk on Windows via `winget install OpenCLICollective.jira-ticket-cli`.

## Automated Publishing

Publishing to Winget is automated via GitHub Actions. When a new release tag is pushed, the release workflow uses `wingetcreate` to submit a PR to [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs).
Publishing to Winget is automated via GitHub Actions. When a new release tag is pushed, the release workflow copies these templates, substitutes version/checksum placeholders, and uses `wingetcreate submit` to submit a PR to [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs).

**Required secret:** `WINGET_GITHUB_TOKEN` - A GitHub PAT with `public_repo` scope, needed to create PRs on microsoft/winget-pkgs.

Expand All @@ -24,17 +24,29 @@ packaging/winget/

Unlike Chocolatey (which hosts packages on their own feed), Winget manifests live in Microsoft's community repository [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs). Publishing requires submitting a PR to that repo.

## Template Placeholders

The manifest templates use these placeholders that are replaced during CI:

| Placeholder | Replaced with |
|-------------|--------------|
| `0.0.0` | Release version (e.g., `0.1.18`) |
| `CHECKSUM_AMD64_PLACEHOLDER` | SHA256 of the x64 zip |
| `CHECKSUM_ARM64_PLACEHOLDER` | SHA256 of the arm64 zip |

URLs contain `0.0.0` in both the tag path and filename, so the version replacement handles them automatically.

## Publishing a New Version

### Option 1: Manual PR

1. **Get release info:**
- Download URLs: `https://github.com/open-cli-collective/jira-ticket-cli/releases/download/v<VERSION>/jira-ticket-cli_<VERSION>_windows_amd64.zip`
- Download URLs: `https://github.com/open-cli-collective/atlassian-cli/releases/download/jtk-v<VERSION>/jtk_<VERSION>_windows_amd64.zip`
- SHA256 checksums from `checksums.txt` in the release

2. **Update manifests:**
- Replace `0.0.0` with the actual version in all three YAML files
- Replace placeholder checksums with real SHA256 values
- Replace checksum placeholders with real SHA256 values

3. **Validate manifests:**
```powershell
Expand All @@ -52,19 +64,14 @@ Unlike Chocolatey (which hosts packages on their own feed), Winget manifests liv

7. **Submit PR** to microsoft/winget-pkgs

### Option 2: Using wingetcreate

[wingetcreate](https://github.com/microsoft/winget-create) can generate manifests from URLs:
### Option 2: Using wingetcreate submit

```powershell
# Install wingetcreate
winget install Microsoft.WingetCreate

# Create new manifest (interactive)
wingetcreate new https://github.com/open-cli-collective/jira-ticket-cli/releases/download/v<VERSION>/jira-ticket-cli_<VERSION>_windows_amd64.zip

# Or update existing manifest
wingetcreate update OpenCLICollective.jira-ticket-cli --version <VERSION> --urls <x64_url> <arm64_url>
# Copy and update templates, then submit
wingetcreate submit --path <manifest-dir> --token <PAT>
```

## Manifest Schema
Expand All @@ -79,25 +86,16 @@ These manifests use schema version 1.10.0:
This package uses:
- `InstallerType: zip` - Our releases are zip archives
- `NestedInstallerType: portable` - Contains a standalone executable
- `PortableCommandAlias: jira-ticket-cli` - Command users type to invoke the tool
- `PortableCommandAlias: jtk` - Command users type to invoke the tool

Winget extracts the zip, places `jira-ticket-cli.exe` in a managed location, and creates the command alias.
Winget extracts the zip, places `jtk.exe` in a managed location, and creates the command alias.

## Architecture Support

| Architecture | Installer URL Pattern |
|--------------|----------------------|
| x64 | `jira-ticket-cli_<VERSION>_windows_amd64.zip` |
| arm64 | `jira-ticket-cli_<VERSION>_windows_arm64.zip` |

## Manual Retry Workflow

If automated publishing fails, use the manual workflow:

1. Go to Actions → "Publish to Winget"
2. Click "Run workflow"
3. Enter the version (e.g., `0.1.0`)
4. Click "Run workflow"
| x64 | `jtk_<VERSION>_windows_amd64.zip` |
| arm64 | `jtk_<VERSION>_windows_arm64.zip` |

## After Approval

Expand Down
Loading