Download a binary and add it to PATH on Windows

I’m trying to run python tests on a Windows environment. These tests are using one application client. To run these tests, I have a step that installs this client binary before running these tests.

- name: Install minio client
  if: startsWith(runner.os, 'Windows')
  run: |
      curl "https://dl.min.io/client/mc/release/windows-amd64/mc.exe" --output mc.exe

Now I have to add this client to PATH. I tried to run this:

- name: Add minio client to path
  if: startsWith(runner.os, 'Windows')
  run: |
      echo "::add-path::$GITHUB_WORKSPACE\mc.exe"

but I don’t think it worked because my tests have failed due to a missing minio client.

What am I doing wrong? Thank you :slight_smile:

Hi @michalb-dsg,

Glad to see you in Github Community Forum!

Typically environment PATH should be the folder which contains the binary. The default working directory is $GITHUB_WORKSPACE, you can directly use command like below:

- name: Install minio client
  if: startsWith(runner.os, 'Windows')
  run: |
      curl "https://dl.min.io/client/mc/release/windows-amd64/mc.exe" --output mc.exe
- name: execute
  shell: cmd            #use cmd here.
   run: |
       mc.exe --help  # the default directory is workspace, it can find the mc.exe directly

Or if you’d like to add the binary to PATH, you can use below code:

      - name: Add minio client to path
        if: startsWith(runner.os, 'Windows')
        run: |
            echo "::add-path::${{ github.workspace }}\mc.exe"         
      - name: check2
        run: |
          $env:PATH            # check the PATH

Thanks