From bee22f3ec829f13a4f0799ad34efd2c49ca9e39d Mon Sep 17 00:00:00 2001 From: sitiom Date: Sat, 18 Mar 2023 06:57:42 +0800 Subject: [PATCH] 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 --- .github/workflows/winget.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/winget.yml diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml new file mode 100644 index 00000000000..9bf6910cafc --- /dev/null +++ b/.github/workflows/winget.yml @@ -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