From 1f4ef3b606251b5e575dfb973bb5635cdc1206db Mon Sep 17 00:00:00 2001 From: TechWatching <15186176+TechWatching@users.noreply.github.com> Date: Thu, 22 Jul 2021 18:38:03 +0200 Subject: [PATCH] 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 --- .github/workflows/release.yml | 19 +------------------ .github/workflows/winget-submission.yml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/winget-submission.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8e85bff1..955812fde 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/winget-submission.yml b/.github/workflows/winget-submission.yml new file mode 100644 index 000000000..2b64b1b6e --- /dev/null +++ b/.github/workflows/winget-submission.yml @@ -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 }}