Add a Winget Releaser workflow (#14965)

[The winget-releaser action] automatically generates manifests for the
[Winget Community Repository] and submits them.

I suggest adding Dependabot to keep the action up to date. There were
many cases where the action was failing due to an outdated version.

Closes #14795

[The winget-releaser action]:
https://github.com/vedantmgoyal2009/winget-releaser
[Winget Community Repository]: https://github.com/microsoft/winget-pkgs
This commit is contained in:
sitiom 2023-03-18 06:57:42 +08:00 committed by GitHub
parent b6bb3e0a80
commit bee22f3ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

27
.github/workflows/winget.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Publish to Winget
on:
release:
types: [published]
env:
REGEX: 'Microsoft\.WindowsTerminal(?:Preview)?_Win10_([\d.]+)_8wekyb3d8bbwe\.msixbundle$'
jobs:
publish:
runs-on: windows-latest # Action can only run on Windows
steps:
- name: Extract version from release asset
id: extract-version
run: |
$version = '${{ toJSON(github.event.release.assets.*.name) }}' | ConvertFrom-Json | Select-String -Pattern $env:REGEX | ForEach-Object { $_.Matches.Groups[1].Value }
Write-Output "version=$version" >> $env:GITHUB_OUTPUT
- name: Publish ${{ github.event.release.prerelease && 'Preview' || 'Stable' }}
uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: Microsoft.WindowsTerminal${{ github.event.release.prerelease && '.Preview' || '' }}
version: ${{ steps.extract-version.outputs.version }}
installers-regex: ${{ env.REGEX }}
token: ${{ secrets.WINGET_TOKEN }}
fork-user: DHowett