Skip to content

Commit

Permalink
feat: winget support
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed May 30, 2021
1 parent 8ef355d commit c2cfd70
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ jobs:
needs: [release, artifacts]
if: ${{ needs.release.outputs.skipped == 'false' }}
runs-on: windows-latest
outputs:
hash: ${{ steps.hash.outputs.hash_inno }}
defaults:
run:
shell: pwsh
Expand All @@ -246,6 +248,11 @@ jobs:
uses: actions/checkout@v2
- name: Build installer
run: ./build.ps1 -Version ${{ needs.release.outputs.version }}
- name: Output Hash
id: hash
run: |
$hash = Get-Content -Path Output/install.exe.sha256
Write-Output "::set-output name=hash_inno::$($hash)"
- name: Upload Inno Installer
id: upload-inno-installer
uses: actions/upload-release-asset@v1
Expand Down
15 changes: 15 additions & 0 deletions packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PackageIdentifier: JanDeDobbeleer.OhMyPosh
PackageVersion: <VERSION>
InstallModes:
- "silent"
Installers:
- Architecture: x64
InstallerType: inno
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install.exe
InstallerSha256: <HASH>
- Architecture: x86
InstallerType: inno
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install.exe
InstallerSha256: <HASH>
ManifestType: "installer"
ManifestVersion: 1.0.0
22 changes: 22 additions & 0 deletions packages/winget/JanDeDobbeleer.OhMyPosh.locale.en-US.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PackageIdentifier: JanDeDobbeleer.OhMyPosh
PackageVersion: <VERSION>
PackageLocale: en-US
Publisher: Jan De Dobbeleer
PackageName: Oh My Posh
License: GPL
ShortDescription: Prompt theme engine for any shell
Tags:
- "Console"
- "Command-Line"
- "Shell"
- "Command-Prompt"
- "PowerShell"
- "WSL"
- "Developer-Tools"
- "Utilities"
- "cli"
- "cmd"
- "ps"
- "terminal"
ManifestType: defaultLocale
ManifestVersion: 1.0.0
5 changes: 5 additions & 0 deletions packages/winget/JanDeDobbeleer.OhMyPosh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PackageIdentifier: JanDeDobbeleer.OhMyPosh
PackageVersion: <VERSION>
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.0.0
44 changes: 44 additions & 0 deletions packages/winget/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

Param
(
[parameter(Mandatory = $true)]
[string]
$Version,
[parameter(Mandatory = $true)]
[string]
$Hash,
[parameter(Mandatory = $false)]
[string]
$Token
)

function Set-Version {
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)
$content | Out-File -Encoding 'UTF8' "./$Version/$FileName"
}

New-Item -Path $PWD -Name $Version -ItemType "directory"
# Get all files inside the folder and adjust the version/hash
Get-ChildItem '*.yaml' | ForEach-Object -Process {
Set-Version -FileName $_.Name -Version $Version -Hash $hash
}
if (-not $Token) {
return
}
# Get the latest wingetcreate exe
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
# Create the PR
wingetcreate.exe submit --path $Version --token $Token

0 comments on commit c2cfd70

Please sign in to comment.