diff --git a/package/winget/build.ps1 b/package/winget/build.ps1 new file mode 100644 index 0000000..84d6c5c --- /dev/null +++ b/package/winget/build.ps1 @@ -0,0 +1,63 @@ + +Param +( + [parameter(Mandatory = $true)] + [string] + $Version, + [parameter(Mandatory = $false)] + [string] + $Token +) + +function Get-HashForWindowsZip { + param ( + # Parameter help description + [Parameter(Mandatory = $true)] + [string] + $Version + ) + $Url = "https://github.com/zurawiki/gptcommit/releases/download/v$Version/gptcommit-x86_64-pc-windows-msvc.zip" + $FilePath = "$($env:TEMP)\$(Split-Path -Leaf $Url)" + Invoke-WebRequest -Uri $Url -OutFile $FilePath + $Hash = Get-FileHash $FilePath -Algorithm SHA256 | Select-Object -ExpandProperty Hash + Remove-Item $FilePath + return $Hash +} + +function Write-MetaData { + param( + [Parameter(Mandatory = $true)] + [string] + $FileName, + [Parameter(Mandatory = $true)] + [string] + $Version, + [Parameter(Mandatory = $true)] + [string] + $Hash + ) + $content = Get-Content $FileName -Raw + $content = $content.Replace('', $Version) + $content = $content.Replace('', $Hash) + $date = Get-Date -Format "yyyy-MM-dd" + $content = $content.Replace('', $date) + $content | Out-File -Encoding 'UTF8' "./$Version/$FileName" +} + +New-Item -Path $PWD -Name $Version -ItemType "directory" +$Hash = Get-HashForWindowsZip -Version $Version +Get-ChildItem '*.yaml' | ForEach-Object -Process { + Write-MetaData -FileName $_.Name -Version $Version -Hash $Hash +} +if (-not $Token) { + return +} + +# Download Winget-Create msixbundle, install, and execute update. +$appxBundleFile = "$env:TEMP\wingetcreate.msixbundle" +Invoke-WebRequest https://aka.ms/wingetcreate/latest/msixbundle -OutFile $appxBundleFile +Add-AppxPackage $appxBundleFile + +# Create PR +# wingetcreate submit --token +wingetcreate submit --token $Token $Version \ No newline at end of file diff --git a/package/winget/zurawiki.gptcommit.installer.yaml b/package/winget/zurawiki.gptcommit.installer.yaml new file mode 100644 index 0000000..c6efb33 --- /dev/null +++ b/package/winget/zurawiki.gptcommit.installer.yaml @@ -0,0 +1,21 @@ +PackageIdentifier: zurawiki.gptcommit +PackageVersion: +ReleaseDate: +InstallerType: zip +Installers: + - Architecture: x64 + InstallerUrl: https://github.com/zurawiki/gptcommit/releases/download/v/gptcommit-x86_64-pc-windows-msvc.zip + InstallerSha256: + NestedInstallerType: portable + NestedInstallerFiles: + - RelativeFilePath: .\gptcommit.exe + PortableCommandAlias: gptcommit + - Architecture: x86 + InstallerUrl: https://github.com/zurawiki/gptcommit/releases/download/v/gptcommit-x86_64-pc-windows-msvc.zip + InstallerSha256: + NestedInstallerType: portable + NestedInstallerFiles: + - RelativeFilePath: .\gptcommit.exe + PortableCommandAlias: gptcommit +ManifestType: installer +ManifestVersion: 1.4.0 diff --git a/package/winget/zurawiki.gptcommit.locale.en-US.yaml b/package/winget/zurawiki.gptcommit.locale.en-US.yaml new file mode 100644 index 0000000..f353df0 --- /dev/null +++ b/package/winget/zurawiki.gptcommit.locale.en-US.yaml @@ -0,0 +1,30 @@ +PackageIdentifier: zurawiki.gptcommit +PackageVersion: +PackageLocale: en-US +Publisher: Roger Zurawicki +PublisherUrl: https://github.com/zurawiki/gptcommit +PublisherSupportUrl: https://github.com/zurawiki/gptcommit/issues +Author: Roger Zurawicki +PackageName: gptcommit +PackageUrl: https://github.com/zurawiki/gptcommit +License: MIT +LicenseUrl: https://github.com/zurawiki/gptcommit/blob/main/LICENSE +ShortDescription: A git prepare-commit-msg hook for authoring commit messages with GPT-3 +Tags: + - "console" + - "command-line" + - "shell" + - "command-prompt" + - "powershell" + - "wsl" + - "developer-tools" + - "utilities" + - "cli" + - "cmd" + - "ps" + - "terminal" + - "gptcommit" + - "git" +ManifestType: defaultLocale +ManifestVersion: 1.4.0 +ReleaseNotesUrl: https://github.com/zurawiki/gptcommit/releases/tag/v0.56 diff --git a/package/winget/zurawiki.gptcommit.yaml b/package/winget/zurawiki.gptcommit.yaml new file mode 100644 index 0000000..7d97987 --- /dev/null +++ b/package/winget/zurawiki.gptcommit.yaml @@ -0,0 +1,5 @@ +PackageIdentifier: zurawiki.gptcommit +PackageVersion: +DefaultLocale: en-US +ManifestType: version +ManifestVersion: 1.4.0