From d9e12afc9c01e45859a8508d01c50cacb700a8e5 Mon Sep 17 00:00:00 2001 From: Kaleb Luedtke Date: Thu, 4 Dec 2025 16:26:21 -0600 Subject: [PATCH] Add workflow to automatically submit to Winget --- .github/workflows/winget.yml | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 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 0000000..2c04f58 --- /dev/null +++ b/.github/workflows/winget.yml @@ -0,0 +1,44 @@ +name: Submit release to the WinGet community repository + +on: + release: + types: [published] + +jobs: + publish-winget: + name: Submit to WinGet repository + + # GitHub token permissions needed for winget-create to submit a PR + permissions: + contents: read + pull-requests: write + + # winget-create is only supported on Windows + runs-on: windows-latest + + # winget-create will read the following environment variable to access the GitHub token needed for submitting a PR + # See https://aka.ms/winget-create-token + env: + WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }} + + steps: + - name: Submit package using wingetcreate + run: | + # Set the package ID based on the release info + $packageId = if (${{ !github.event.release.prerelease }}) { "GitHub.Copilot" } else { "GitHub.Copilot.Prerelease" } + + # Get installer info from release event + $assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json + $packageVersion = (${{ toJSON(github.event.release.tag_name) }}) + + # Find the download URLs for the x64 and arm64 installers separately + # This allows overrides to be used so that wingetcreate does not have to guess the architecture from the filename + $installerUrlx64 = $assets | Where-Object -Property name -like '*win32-x64.zip' | Select-Object -ExpandProperty browser_download_url + $installerUrlarm64 = $assets | Where-Object -Property name -like '*win32-arm64.zip' | Select-Object -ExpandProperty browser_download_url + + # Update package using wingetcreate + curl.exe -JLO https://aka.ms/wingetcreate/latest + .\wingetcreate.exe update $packageId ` + --version $packageVersion ` + --urls "$installerUrlx64|x64" "$installerUrlarm64|arm64" ` + --submit