Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bit hard to figure out what to type for a local file on windows in installer-url #341

Open
moorepants opened this issue Apr 6, 2024 · 4 comments

Comments

@moorepants
Copy link

moorepants commented Apr 6, 2024

I spent quite some time this morning figuring this out as it wasn't obvious from the docs or examples. It may be obvious for a Javascript developer that knows how this works:

// Node program to demonstrate the  
// URL.fileURLToPath() API as Setter 
  
// Importing the module 'url'  
const url = require('url'); 
  
// Some random path from system 
const file = 'file:///C:/path/example/gfg'
   
// Converting the file to properly encoded path 
console.log(url.fileURLToPath(file)) 

which returns:

 C:\path\example\gfg

taken from: https://www.geeksforgeeks.org/node-js-url-fileurltopath-api/

I finally got a local exe to build on a Github action with:

      - uses: conda-incubator/setup-miniconda@v3
        with:
          auto-update-conda: true
          installer-url: file:///D:/r/repoowner/reponame/anaconda-installer-Windows-x86_64.exe

I can also probably remove the full path, but the key things are 1) use forward slashes, even if you are on windows and 2) use three forward slashes after file:.

It could be helpful to give an example of this in the docs of this repo. Thanks for the action!

@moorepants moorepants changed the title Bit hard to figure out what to type for a local file on windows in Installer-Url Bit hard to figure out what to type for a local file on windows in installer-url Apr 6, 2024
@moorepants
Copy link
Author

There is this:

file:///tmp/some-built-installer-${{ github.run_number

but that is on Ubuntu so it wasn't obvious for me what to do on Windows (use forward slashes not backslashes).

@moorepants
Copy link
Author

One more note is that the path to the file must be absolute. A relative path failed.

@dokempf
Copy link

dokempf commented Apr 17, 2024

I cannot confirm your findings here. I have a running action with the following URL:

installer-url: file://D:\a\helios-installer\helios-installer/dist/helios-2.0.0a1-Windows-x86_64.exe

which does not have triple / and mixed / and \. You find the code here: https://github.com/ssciwr/helios-installer/blob/main/.github/workflows/installer.yml#L102

@moorepants
Copy link
Author

Here are the various commits that show what I tried: moorepants/anaconda-dee-config#1

It works now, so I will stick with the triple and forward slashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants