name: Update winget package

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version number'
        required: true

jobs:
  wingetcreate-update:
    runs-on: windows-latest
    steps:
      - uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '5.0.x'
      - name: Run wingetcreate
        env:
          APP_VERSION: ${{ github.event.inputs.version }}
          WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
        shell: cmd
        run: |
          curl https://aka.ms/wingetcreate/latest -L --output wingetcreate.exe
          wingetcreate.exe update jely2002.youtube-dl-gui -s true -u https://github.com/jely2002/youtube-dl-gui/releases/download/v%APP_VERSION%/Open-Video-Downloader-Setup-%APP_VERSION%.exe -v %APP_VERSION%  -t %WINGET_TOKEN%
