ci: winget (#101)

This commit is contained in:
Lewis Crichton 2023-08-27 21:27:23 +01:00 committed by GitHub
parent 9bb02f8581
commit 196ee4e42c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

33
.github/workflows/winget-submission.yml vendored Normal file
View file

@ -0,0 +1,33 @@
# Based on Microsoft/DevHome Winget CI, modified for use in Vencord/Vesktop.
#
# Copyright (c) Microsoft Corporation and Contributors
# Licensed under the MIT license.
name: Submit to Winget Community Repo
on:
workflow_dispatch:
release:
types: [published]
jobs:
winget:
name: Publish winget package
runs-on: windows-latest
env:
WINGET_PAT: ${{ secrets.WINGET_PAT }}
steps:
- name: Submit package to Winget Community Repo
run: |
$packageId = "Vencord.Vesktop"
# Fetching latest release from GitHub
$github = Invoke-RestMethod -uri "https://api.github.com/repos/vencord/vesktop/releases"
$targetRelease = $github | Select-Object -First 1
$installerUrl = $targetRelease | Select-Object -ExpandProperty assets -First 1 | Where-Object -Property name -match 'Vesktop-Setup.*?exe' | Select-Object -ExpandProperty browser_download_url
$packageVersion = $targetRelease.tag_name.Trim("v")
# Update package using wingetcreate
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $packageId --version $packageVersion --urls "$installerUrl" --submit --token $env:WINGET_PAT