baptiste0928/cargo-install

Latest version being installed even though a fixed version is specified

sunshowers opened this issue · 8 comments

Hi again --

Noticed that the latest version of a crate is being installed even though a fixed version is specified.

For example, this workflow installed version 0.22.2: https://github.com/nextest-rs/nextest/actions/runs/3389729301/jobs/5633134431

With this workflow file: https://github.com/nextest-rs/nextest/actions/runs/3389729301/workflow#L104-L107

Could you look into this? Thanks!

Oh I think I need to specify the version with an equals sign. Wondering if this is caused by a difference between cargo's and node's respective meanings of semver version requirements around 0.x versions.

Thinking about this a bit more: I think that when an exact version is specified, most people expect the installation to be for that specific version -- otherwise, the standard semver requirement logic should apply.

I wrote a Rust version of this logic here:

What do you think?

Thanks for reporting this bug!

Node treats caret requirements the same way as cargo, but this isn't properly implemented in the compare-versions package that is used to handle version requirements (omichelsen/compare-versions#65).

I will switch to the semver package (that is internally used by npm).

Thanks! What do you think of the suggestion to use the exact version if one is specified that way?

Hi again ! I switched to semver in the next branch. Can you please test it on your workflow and tell me if it works?

You can use the next branch in your workflow with the following syntax:

-  uses: baptiste0928/cargo-install@next

What do you think of the suggestion to use the exact version if one is specified that way?

It's a good idea, I added this to the planned features for v2 (#5).

Just swinging by to report that this didn't seem to work for me in the next branch with the caret syntax:

Run baptiste0928/cargo-install@next      # Using next branch
  with:
    crate: tauri-cli
    version: ^1.0.0-rc.10      # Explicit version
    locked: false
  env:
     ...
Installing tauri-cli ...
  Fetching crate information on crates.io ...
  Installation settings:
     version: 1.2.2         # Version gets ignored
...

Update: Ignore me - I think this may be an issue on my end. Leaving the comment here just in case it is helpful.

This still picks up the last one (v0.23.0)

    - name: Install uniffi_bindgen
      uses: baptiste0928/cargo-install@v1
         with:
           crate: uniffi_bindgen
           version: "0.22.0"

I just released an update that switches to semver for version resolution, this should fix this issue 😄