|
| 1 | +name: Publish to WinGet |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [released] |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + tag: |
| 9 | + description: "Release tag (e.g. v0.1.0)" |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + version: |
| 13 | + description: "Version string without v prefix (e.g. 0.1.0)" |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + secrets: |
| 17 | + WINGET_PAT: |
| 18 | + required: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + publish: |
| 22 | + runs-on: windows-latest |
| 23 | + steps: |
| 24 | + - name: Resolve version |
| 25 | + id: version |
| 26 | + shell: pwsh |
| 27 | + run: | |
| 28 | + $tag = "${{ inputs.tag || github.event.release.tag_name }}" |
| 29 | + $version = "${{ inputs.version }}" |
| 30 | + if (-not $version) { $version = $tag.TrimStart('v') } |
| 31 | + "version=$version" >> $env:GITHUB_OUTPUT |
| 32 | + "tag=$tag" >> $env:GITHUB_OUTPUT |
| 33 | +
|
| 34 | + - name: Download release assets |
| 35 | + shell: pwsh |
| 36 | + run: | |
| 37 | + $tag = "${{ steps.version.outputs.tag }}" |
| 38 | + $version = "${{ steps.version.outputs.version }}" |
| 39 | + $baseUrl = "https://github.com/${{ github.repository }}/releases/download/$tag" |
| 40 | + Invoke-WebRequest "$baseUrl/CopilotTaskbarApp-$version-win-x64.zip" -OutFile x64.zip |
| 41 | + Invoke-WebRequest "$baseUrl/CopilotTaskbarApp-$version-win-arm64.zip" -OutFile arm64.zip |
| 42 | +
|
| 43 | + - name: Compute SHA256 hashes |
| 44 | + id: hash |
| 45 | + shell: pwsh |
| 46 | + run: | |
| 47 | + $x64Hash = (Get-FileHash x64.zip -Algorithm SHA256).Hash |
| 48 | + $arm64Hash = (Get-FileHash arm64.zip -Algorithm SHA256).Hash |
| 49 | + "x64=$x64Hash" >> $env:GITHUB_OUTPUT |
| 50 | + "arm64=$arm64Hash" >> $env:GITHUB_OUTPUT |
| 51 | +
|
| 52 | + - name: Create winget manifest |
| 53 | + shell: pwsh |
| 54 | + run: | |
| 55 | + $version = "${{ steps.version.outputs.version }}" |
| 56 | + $tag = "${{ steps.version.outputs.tag }}" |
| 57 | + $baseUrl = "https://github.com/${{ github.repository }}/releases/download/$tag" |
| 58 | + $dir = "manifests/s/sirredbeard/CopilotTaskbarApp/$version" |
| 59 | + New-Item -ItemType Directory -Path $dir -Force | Out-Null |
| 60 | +
|
| 61 | + # Version manifest |
| 62 | + @" |
| 63 | + # yaml-language-server: `$schema=https://aka.ms/winget-manifest.version.1.9.0.schema.json |
| 64 | + PackageIdentifier: sirredbeard.CopilotTaskbarApp |
| 65 | + PackageVersion: $version |
| 66 | + DefaultLocale: en-US |
| 67 | + ManifestType: version |
| 68 | + ManifestVersion: 1.9.0 |
| 69 | + "@ -replace '(?m)^ ', '' | Set-Content "$dir/sirredbeard.CopilotTaskbarApp.yaml" -NoNewline |
| 70 | +
|
| 71 | + # Default locale manifest |
| 72 | + @" |
| 73 | + # yaml-language-server: `$schema=https://aka.ms/winget-manifest.defaultLocale.1.9.0.schema.json |
| 74 | + PackageIdentifier: sirredbeard.CopilotTaskbarApp |
| 75 | + PackageVersion: $version |
| 76 | + PackageLocale: en-US |
| 77 | + Publisher: sirredbeard |
| 78 | + PublisherUrl: https://github.com/sirredbeard |
| 79 | + PackageName: Copilot Taskbar |
| 80 | + PackageUrl: https://github.com/${{ github.repository }} |
| 81 | + License: MIT |
| 82 | + LicenseUrl: https://github.com/${{ github.repository }}/blob/main/LICENSE |
| 83 | + ShortDescription: System tray access to GitHub Copilot with automatic context awareness |
| 84 | + Tags: |
| 85 | + - copilot |
| 86 | + - github |
| 87 | + - ai |
| 88 | + - developer-tools |
| 89 | + ManifestType: defaultLocale |
| 90 | + ManifestVersion: 1.9.0 |
| 91 | + "@ -replace '(?m)^ ', '' | Set-Content "$dir/sirredbeard.CopilotTaskbarApp.locale.en-US.yaml" -NoNewline |
| 92 | +
|
| 93 | + # Installer manifest |
| 94 | + @" |
| 95 | + # yaml-language-server: `$schema=https://aka.ms/winget-manifest.installer.1.9.0.schema.json |
| 96 | + PackageIdentifier: sirredbeard.CopilotTaskbarApp |
| 97 | + PackageVersion: $version |
| 98 | + MinimumOSVersion: 10.0.17763.0 |
| 99 | + InstallerType: zip |
| 100 | + NestedInstallerType: portable |
| 101 | + NestedInstallerFiles: |
| 102 | + - RelativeFilePath: CopilotTaskbarApp.exe |
| 103 | + PortableCommandAlias: copilot-taskbar |
| 104 | + Installers: |
| 105 | + - Architecture: x64 |
| 106 | + InstallerUrl: $baseUrl/CopilotTaskbarApp-$version-win-x64.zip |
| 107 | + InstallerSha256: ${{ steps.hash.outputs.x64 }} |
| 108 | + - Architecture: arm64 |
| 109 | + InstallerUrl: $baseUrl/CopilotTaskbarApp-$version-win-arm64.zip |
| 110 | + InstallerSha256: ${{ steps.hash.outputs.arm64 }} |
| 111 | + ManifestType: installer |
| 112 | + ManifestVersion: 1.9.0 |
| 113 | + "@ -replace '(?m)^ ', '' | Set-Content "$dir/sirredbeard.CopilotTaskbarApp.installer.yaml" -NoNewline |
| 114 | +
|
| 115 | + - name: Install wingetcreate |
| 116 | + shell: pwsh |
| 117 | + run: | |
| 118 | + Invoke-WebRequest "https://aka.ms/wingetcreate/latest" -OutFile wingetcreate.exe |
| 119 | +
|
| 120 | + - name: Validate and submit manifest |
| 121 | + shell: pwsh |
| 122 | + run: | |
| 123 | + $version = "${{ steps.version.outputs.version }}" |
| 124 | + $dir = "manifests/s/sirredbeard/CopilotTaskbarApp/$version" |
| 125 | +
|
| 126 | + .\wingetcreate.exe submit --token "${{ secrets.WINGET_PAT }}" $dir |
0 commit comments