Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI action for publishing package to WinGet #852

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/submit-winget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Submit published release to WinGet community repository

on:
release:
types: [published]

jobs:
publish-winget:
name: Submit to WinGet repository
runs-on: windows-latest
# Only submit stable releases
if: ${{ !github.event.release.prerelease }}
steps:
# Sometimes wingetcreate may fail to sync fork automatically, so we do it manually here.
# Ref: https://github.com/microsoft/winget-create/issues/502
- name: Sync winget-pkgs fork
run: gh repo sync DaveTryon/winget-pkgs -b master
env:
GH_TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }}
- name: Submit package using wingetcreate
run: |
# Get installer info from release event
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
$installerUrl = $assets | Where-Object -Property name -eq 'sbom-tool-win-x64.exe' | Select-Object -ExpandProperty browser_download_url
$packageVersion = (${{ toJSON(github.event.release.tag_name) }}).Trim('v')

# Update package using wingetcreate
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update Microsoft.SBOMTool --version $packageVersion --urls $installerUrl --submit --token "${{ secrets.WINGET_GITHUB_TOKEN }}"