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 31, 2021
1 parent 8ef355d commit 9018e66
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
22 changes: 22 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 All @@ -266,3 +273,18 @@ jobs:
asset_path: ${{ github.workspace }}/packages/inno/Output/install.exe.sha256
asset_name: install.exe.sha256
asset_content_type: text/plain
winget:
needs: [release, inno]
if: ${{ needs.release.outputs.skipped == 'false' }}
runs-on: windows-latest
defaults:
run:
shell: pwsh
working-directory: ${{ github.workspace }}/packages/winget
env:
WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create manifest and submit PR
run: ./build.ps1 -Version ${{ needs.release.outputs.version }} -Hash ${{ needs.inno.outputs.hash }} -Token $env:WINGETCREATE_TOKEN
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
49 changes: 49 additions & 0 deletions packages/winget/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

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
# Replace with the following once https://github.com/microsoft/winget-create/issues/38 is resolved:
# Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
Invoke-WebRequest 'https://github.com/JanDeDobbeleer/winget-create/releases/latest/download/wingetcreate.zip' -OutFile wingetcreate.zip
Expand-Archive -LiteralPath wingetcreate.zip -DestinationPath wingetcreate
$wingetcreate = Resolve-Path -Path wingetcreate
$env:Path += ";$($wingetcreate.Path)"
# Create the PR
WingetCreateCLI.exe submit --token $Token $Version

0 comments on commit 9018e66

Please sign in to comment.