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
63 changes: 63 additions & 0 deletions package/winget/build.ps1
Original file line number Diff line number Diff line change
@@ -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>', $Version)
$content = $content.Replace('<HASH>', $Hash)
$date = Get-Date -Format "yyyy-MM-dd"
$content = $content.Replace('<DATE>', $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 <GitHubPersonalAccessToken> <PathToManifest>
wingetcreate submit --token $Token $Version
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What permissions does the Github token need here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Github token is use for creating a PR in https://github.com/microsoft/winget-pkgs

21 changes: 21 additions & 0 deletions package/winget/zurawiki.gptcommit.installer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PackageIdentifier: zurawiki.gptcommit
PackageVersion: <VERSION>
ReleaseDate: <DATE>
InstallerType: zip
Installers:
- Architecture: x64
InstallerUrl: https://github.com/zurawiki/gptcommit/releases/download/v<VERSION>/gptcommit-x86_64-pc-windows-msvc.zip
InstallerSha256: <HASH>
NestedInstallerType: portable
NestedInstallerFiles:
- RelativeFilePath: .\gptcommit.exe
PortableCommandAlias: gptcommit
- Architecture: x86
InstallerUrl: https://github.com/zurawiki/gptcommit/releases/download/v<VERSION>/gptcommit-x86_64-pc-windows-msvc.zip
InstallerSha256: <HASH>
NestedInstallerType: portable
NestedInstallerFiles:
- RelativeFilePath: .\gptcommit.exe
PortableCommandAlias: gptcommit
ManifestType: installer
ManifestVersion: 1.4.0
30 changes: 30 additions & 0 deletions package/winget/zurawiki.gptcommit.locale.en-US.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PackageIdentifier: zurawiki.gptcommit
PackageVersion: <VERSION>
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
5 changes: 5 additions & 0 deletions package/winget/zurawiki.gptcommit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PackageIdentifier: zurawiki.gptcommit
PackageVersion: <VERSION>
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.4.0