From af71b085b226866ce828fb27f30e8dde7af2f33c Mon Sep 17 00:00:00 2001 From: Stephen Griffin Date: Thu, 26 Dec 2024 08:39:20 -0500 Subject: [PATCH] U/sgriffin/winget (#799) * Add winget action * add comment * Update UpdateWinget.yml * Update UpdateWinget.yml * Update UpdateWinget.yml * Update UpdateWinget.yml * Update UpdateWinget.yml * make testable * remove push test --- .github/workflows/UpdateWinget.yml | 32 ++++++++++++++++++++++++++++++ mapistub | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/UpdateWinget.yml diff --git a/.github/workflows/UpdateWinget.yml b/.github/workflows/UpdateWinget.yml new file mode 100644 index 000000000..5d406fb61 --- /dev/null +++ b/.github/workflows/UpdateWinget.yml @@ -0,0 +1,32 @@ +# Publishes the latest MFCMAPI release to the Windows Package Manager (Winget) +# https://github.com/microsoft/winget-create?tab=readme-ov-file +name: Update Winget $(Year:yy).0.$(date:yy)$(DayOfYear)$(rev:.rr) + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: '📫🚀 Publish Latest MFCMAPI Release to Winget' + run: | + $wingetPackage = "Microsoft.MFCMAPI" + $gitToken = "${{ secrets.MFCMAPI_WINGET }}" + + $github = Invoke-RestMethod -uri "https://api.github.com/repos/Microsoft/MFCMAPI/releases" + + $targetRelease = $github | Where-Object { -not $_.draft -and -not $_.prerelease }| Select -First 1 + $ver = $targetRelease.tag_name -ireplace '^v' + # Write-Host $targetRelease + # Write-Host $ver + $installerUserX86Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'MFCMAPI.exe' | Select -ExpandProperty browser_download_url + $installerUserX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'MFCMAPI.x64.exe' | Select -ExpandProperty browser_download_url + + # getting latest wingetcreate file + iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe + .\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerUserX86Url|user" "$installerUserX64Url|user" -t $gitToken + shell: pwsh diff --git a/mapistub b/mapistub index fabfa38d8..de52bf471 160000 --- a/mapistub +++ b/mapistub @@ -1 +1 @@ -Subproject commit fabfa38d8c5cb8eddd509f8b5c5ba5fd015482d2 +Subproject commit de52bf471934d3648f621f60599592b246e6dd16