GitHub Actions winget install

On Windows GitHub Actions runs where a Windows program needs to be installed, WinGet can be used like the following example.

In this example, environment variable FFMPEG_ROOT tells Python where to find the ffmpeg.exe program. One could more generally append to the GITHUB_PATH environment variable.

    - name: Install winget
      if: runner.os == 'Windows'
      uses: Cyberboss/install-winget@v1
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    - name: install prereqs (Windows)
      if: runner.os == 'Windows'
      run: winget install ffmpeg --disable-interactivity --accept-source-agreements

    - name: FFMPEG_ROOT Windows
      run: echo "FFMPEG_ROOT=$env:LOCALAPPDATA/Microsoft/WinGet/Links/" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
      if: runner.os == 'Windows'

    - name: PyTest
      run: pytest