# This is a basic workflow that is manually triggered
# Don't run it unless you know what you are doing

name: Manual Workflow for Winget Submission

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
  workflow_dispatch:
    # Inputs the workflow accepts.
    inputs:
      ver:
        # Friendly description to be shown in the UI instead of 'ver'
        description: 'The nushell version to release'
        # Default value if no value is explicitly provided
        default: '0.66.0'
        # Input has to be provided for the workflow to run
        required: true
      uri:
        # Friendly description to be shown in the UI instead of 'uri'
        description: 'The nushell windows .msi package URI to publish'
        # Default value if no value is explicitly provided
        default: 'https://github.com/nushell/nushell/releases/download/0.66.0/nu-0.66.0-x86_64-pc-windows-msvc.msi'
        # Input has to be provided for the workflow to run
        required: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job
  rls-winget-pkg:
    name: Publish winget package manually
    # The type of runner that the job will run on
    runs-on: windows-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Runs commands using the runners shell
    - name: Submit package to Windows Package Manager Community Repository Manually
      run: |
          iwr https://github.com/microsoft/winget-create/releases/download/v1.0.4.0/wingetcreate.exe -OutFile wingetcreate.exe
          .\wingetcreate.exe update Nushell.Nushell -s -v ${{ github.event.inputs.ver }} -u ${{ github.event.inputs.uri }} -t ${{ secrets.NUSHELL_PAT }}
