Add worflow to publish package in winget (#3819)

Remove the job in release workflow to publish to winget.
Trigger winget workflow on published release.

Co-authored-by: Alexandre Nedelec <Alexandre.Nedelec@azeo.com>
This commit is contained in:
TechWatching 2021-07-22 18:38:03 +02:00 committed by GitHub
parent 9b5db297a6
commit 1f4ef3b606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 18 deletions

View File

@ -162,8 +162,6 @@ jobs:
- linux
- macos
- windows
outputs:
version: ${{ steps.info.outputs.version }}
steps:
- name: Check out code
uses: actions/checkout@v2
@ -285,19 +283,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nushell-windows.msi
asset_name: ${{ steps.info.outputs.windowsdir }}.msi
asset_content_type: applictaion/x-msi
winget:
name: Publish winget package
runs-on: windows-latest
needs: release
steps:
- name: Submit package to Windows Package Manager Community Repository
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
$nushellVersion="${{ needs.release.outputs.version }}"
$nushellInstallerName="nu_$($nushellVersion -replace '\.','_')_windows.msi"
$installerUrl = "https://github.com/nushell/nushell/releases/download/$nushellVersion/$nushellInstallerName"
.\wingetcreate.exe update Nushell.Nushell -s -v $nushellVersion -u $installerUrl -t ${{ secrets.NUSHELL_PAT }}
asset_content_type: applictaion/x-msi

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

@ -0,0 +1,18 @@
name: Submit Nushell package to Windows Package Manager Community Repository
on:
release:
types: [published]
jobs:
winget:
name: Publish winget package
runs-on: windows-latest
steps:
- name: Submit package to Windows Package Manager Community Repository
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
$installerUrl = $github.release.assets | Where-Object -Property name -match 'windows.msi' | Select -ExpandProperty browser_download_url -First 1
.\wingetcreate.exe update Nushell.Nushell -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.NUSHELL_PAT }}