game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
822 stars 231 forks source link

UPM config on Windows runners #618

Open lukas-prodviz opened 6 months ago

lukas-prodviz commented 6 months ago

Hello,

According to the documentation, UPM authentication on Ubuntu is configured by creating the upmconfig file under /home/runner/work/_temp/_github_home.

In which directory should this file be placed on Windows runners?

I already tried to use $HOME and change the Ubuntu example from the documentation as follows:

  - name: Create .upmconfig.toml UPM authentication file
    env:
      npm_token: ${{ secrets.NPM_TOKEN }}
    run: |
      cd $HOME
      echo "[npmAuth.`"https://upm.example.com`"]" > .upmconfig.toml
      echo "_auth = `"$Env:npm_token`"" >> .upmconfig.toml
      echo "alwaysAuth = true" >> .upmconfig.toml

But this still gives me the message "... failed because it lacks valid authentication credentials" when the package manager tries to resolve the dependencies, whereas on Ubuntu everything works as expected.

GabLeRoux commented 3 months ago

I think this could be related: https://github.com/game-ci/unity-test-runner/pull/261

It's not for the builder project, but it does work with the .upmconfig.toml. We might need to do similar logic for the builder project.

nvandessel commented 3 months ago

Unfortunately for the test-runner, package-mode has the caveat of only working on Linux runners due to the dependency on jq, issue being tracked here: https://github.com/game-ci/unity-test-runner/issues/224

So that means that I haven't been able to confirm it working on a Windows machine.

One possible option is to try a different location for the toml that is accepted by Unity. See valid locations here. So instead of: cd $HOME, it might be: cd C:\ProgramData\Unity\config\

*Note that my example location requires the file to be named upmconfig.toml without the prepended .