Skip to content

Support for .tool-versions file #17

Description

@swanson

Similar to .ruby-version support, consider supporting .tool-versions: a file used by https://github.com/asdf-vm/asdf to manage multiple language/tool versions in a single place.

Here is a sample of what .tool-versions looks like:

ruby 2.6.5
nodejs 10.13.0

Ideally, if no version is specified for in the workflow step, check for .ruby-version, then .tool-versions as the default.

Activity

  1. ioquatix commented on Feb 8, 2020

    @ioquatix
    Member

    how do you specify different versions like jruby or truffleruby?

  2. eregon commented on Feb 8, 2020

    @eregon
    Member

    @swanson Do you have an example repository using .tool-versions with ruby?

    The documentation of the format seems to be at https://asdf-vm.com/#/core-configuration?id=tool-versions.

    ruby-build doesn't use a ruby- prefix for MRI: https://github.com/rbenv/ruby-build/tree/master/share/ruby-build, and asdf-ruby uses ruby-build.

    So I guess

    ruby truffleruby-19.3.1
    

    would work and use TruffleRuby?

    Could you verify that works @swanson?

  3. swanson commented on Feb 8, 2020

    @swanson
    Author

    Yeah, I believe that is how it works (I've only used asdf with MRI)

    But here is the asdf list of all versions of ruby:

    > asdf list-all ruby
    
    1.8.5-p52
    1.8.5-p113
    1.8.5-p114
    1.8.5-p115
    1.8.5-p231
    1.8.6
    1.8.6-p36
    1.8.6-p110
    1.8.6-p111
    1.8.6-p114
    1.8.6-p230
    1.8.6-p286
    1.8.6-p287
    1.8.6-p368
    1.8.6-p369
    1.8.6-p383
    1.8.6-p388
    1.8.6-p398
    1.8.6-p399
    1.8.6-p420
    1.8.7-preview1
    1.8.7-preview2
    1.8.7-preview3
    1.8.7-preview4
    1.8.7
    1.8.7-p17
    1.8.7-p22
    1.8.7-p71
    1.8.7-p72
    1.8.7-p160
    1.8.7-p173
    1.8.7-p174
    1.8.7-p248
    1.8.7-p249
    1.8.7-p299
    1.8.7-p301
    1.8.7-p302
    1.8.7-p330
    1.8.7-p334
    1.8.7-p352
    1.8.7-p357
    1.8.7-p358
    1.8.7-p370
    1.8.7-p371
    1.8.7-p373
    1.8.7-p374
    1.8.7-p375
    1.9.0-0
    1.9.0-1
    1.9.0-2
    1.9.0-3
    1.9.0-4
    1.9.0-5
    1.9.1-preview1
    1.9.1-preview2
    1.9.1-rc1
    1.9.1-rc2
    1.9.1-p0
    1.9.1-p129
    1.9.1-p243
    1.9.1-p376
    1.9.1-p378
    1.9.1-p429
    1.9.1-p430
    1.9.1-p431
    1.9.2-preview1
    1.9.2-preview3
    1.9.2-rc1
    1.9.2-rc2
    1.9.2-p0
    1.9.2-p136
    1.9.2-p180
    1.9.2-p290
    1.9.2-p318
    1.9.2-p320
    1.9.2-p326
    1.9.2-p330
    1.9.3-dev
    1.9.3-preview1
    1.9.3-rc1
    1.9.3-p0
    1.9.3-p105
    1.9.3-p125
    1.9.3-p194
    1.9.3-p286
    1.9.3-p327
    1.9.3-p362
    1.9.3-p374
    1.9.3-p385
    1.9.3-p392
    1.9.3-p426
    1.9.3-p429
    1.9.3-p448
    1.9.3-p484
    1.9.3-p545
    1.9.3-p547
    1.9.3-p550
    1.9.3-p551
    2.0.0-dev
    2.0.0-preview1
    2.0.0-preview2
    2.0.0-rc1
    2.0.0-rc2
    2.0.0-p0
    2.0.0-p195
    2.0.0-p247
    2.0.0-p353
    2.0.0-p451
    2.0.0-p481
    2.0.0-p576
    2.0.0-p594
    2.0.0-p598
    2.0.0-p643
    2.0.0-p645
    2.0.0-p647
    2.0.0-p648
    2.1.0-dev
    2.1.0-preview1
    2.1.0-preview2
    2.1.0-rc1
    2.1.0
    2.1.1
    2.1.2
    2.1.3
    2.1.4
    2.1.5
    2.1.6
    2.1.7
    2.1.8
    2.1.9
    2.1.10
    2.2.0-dev
    2.2.0-preview1
    2.2.0-preview2
    2.2.0-rc1
    2.2.0
    2.2.1
    2.2.2
    2.2.3
    2.2.4
    2.2.5
    2.2.6
    2.2.7
    2.2.8
    2.2.9
    2.2.10
    2.3.0-dev
    2.3.0-preview1
    2.3.0-preview2
    2.3.0
    2.3.1
    2.3.2
    2.3.3
    2.3.4
    2.3.5
    2.3.6
    2.3.7
    2.3.8
    2.4.0-dev
    2.4.0-preview1
    2.4.0-preview2
    2.4.0-preview3
    2.4.0-rc1
    2.4.0
    2.4.1
    2.4.2
    2.4.3
    2.4.4
    2.4.5
    2.4.6
    2.4.7
    2.4.8
    2.4.9
    2.5.0-dev
    2.5.0-preview1
    2.5.0-rc1
    2.5.0
    2.5.1
    2.5.2
    2.5.3
    2.5.4
    2.5.5
    2.5.6
    2.5.7
    2.6.0-dev
    2.6.0-preview1
    2.6.0-preview2
    2.6.0-preview3
    2.6.0-rc1
    2.6.0-rc2
    2.6.0
    2.6.1
    2.6.2
    2.6.3
    2.6.4
    2.6.5
    2.7.0-dev
    2.7.0-preview1
    2.7.0-preview2
    2.7.0-preview3
    2.7.0-rc1
    2.7.0-rc2
    2.7.0
    jruby-1.5.6
    jruby-1.6.3
    jruby-1.6.4
    jruby-1.6.5
    jruby-1.6.5.1
    jruby-1.6.6
    jruby-1.6.7
    jruby-1.6.7.2
    jruby-1.6.8
    jruby-1.7.0-preview1
    jruby-1.7.0-preview2
    jruby-1.7.0-rc1
    jruby-1.7.0-rc2
    jruby-1.7.0
    jruby-1.7.1
    jruby-1.7.2
    jruby-1.7.3
    jruby-1.7.4
    jruby-1.7.5
    jruby-1.7.6
    jruby-1.7.7
    jruby-1.7.8
    jruby-1.7.9
    jruby-1.7.10
    jruby-1.7.11
    jruby-1.7.12
    jruby-1.7.13
    jruby-1.7.14
    jruby-1.7.15
    jruby-1.7.16
    jruby-1.7.16.1
    jruby-1.7.16.2
    jruby-1.7.17
    jruby-1.7.18
    jruby-1.7.19
    jruby-1.7.20
    jruby-1.7.20.1
    jruby-1.7.21
    jruby-1.7.22
    jruby-1.7.23
    jruby-1.7.24
    jruby-1.7.25
    jruby-1.7.26
    jruby-1.7.27
    jruby-9.0.0.0.pre1
    jruby-9.0.0.0.pre2
    jruby-9.0.0.0.rc1
    jruby-9.0.0.0.rc2
    jruby-9.0.0.0
    jruby-9.0.1.0
    jruby-9.0.3.0
    jruby-9.0.4.0
    jruby-9.0.5.0
    jruby-9.1.0.0-dev
    jruby-9.1.0.0
    jruby-9.1.1.0
    jruby-9.1.2.0
    jruby-9.1.3.0
    jruby-9.1.4.0
    jruby-9.1.5.0
    jruby-9.1.6.0
    jruby-9.1.7.0
    jruby-9.1.8.0
    jruby-9.1.9.0
    jruby-9.1.10.0
    jruby-9.1.11.0
    jruby-9.1.12.0
    jruby-9.1.13.0
    jruby-9.1.14.0
    jruby-9.1.15.0
    jruby-9.1.16.0
    jruby-9.1.17.0
    jruby-9.2.0.0-dev
    jruby-9.2.0.0
    jruby-9.2.1.0-dev
    jruby-9.2.1.0
    jruby-9.2.3.0
    jruby-9.2.4.0
    jruby-9.2.4.1
    jruby-9.2.5.0
    jruby-9.2.6.0
    jruby-9.2.7.0
    jruby-9.2.8.0
    jruby-9.2.9.0
    maglev-1.0.0
    maglev-1.1.0-dev
    maglev-2.0.0-dev
    mruby-dev
    mruby-1.0.0
    mruby-1.1.0
    mruby-1.2.0
    mruby-1.3.0
    mruby-1.4.0
    mruby-1.4.1
    mruby-2.0.0
    mruby-2.0.1
    mruby-2.1.0
    rbx-2.2.2
    rbx-2.2.3
    rbx-2.2.4
    rbx-2.2.5
    rbx-2.2.6
    rbx-2.2.7
    rbx-2.2.8
    rbx-2.2.9
    rbx-2.2.10
    rbx-2.3.0
    rbx-2.4.0
    rbx-2.4.1
    rbx-2.5.0
    rbx-2.5.1
    rbx-2.5.2
    rbx-2.5.3
    rbx-2.5.4
    rbx-2.5.5
    rbx-2.5.6
    rbx-2.5.7
    rbx-2.5.8
    rbx-2.6
    rbx-2.7
    rbx-2.8
    rbx-2.9
    rbx-2.10
    rbx-2.11
    rbx-2.71828182
    rbx-3.0
    rbx-3.1
    rbx-3.2
    rbx-3.3
    rbx-3.4
    rbx-3.5
    rbx-3.6
    rbx-3.7
    rbx-3.8
    rbx-3.9
    rbx-3.10
    rbx-3.11
    rbx-3.12
    rbx-3.13
    rbx-3.14
    rbx-3.15
    rbx-3.16
    rbx-3.17
    rbx-3.18
    rbx-3.19
    rbx-3.20
    rbx-3.21
    rbx-3.22
    rbx-3.23
    rbx-3.24
    rbx-3.25
    rbx-3.26
    rbx-3.27
    rbx-3.28
    rbx-3.29
    rbx-3.30
    rbx-3.31
    rbx-3.32
    rbx-3.33
    rbx-3.34
    rbx-3.35
    rbx-3.36
    rbx-3.37
    rbx-3.38
    rbx-3.39
    rbx-3.40
    rbx-3.41
    rbx-3.42
    rbx-3.43
    rbx-3.44
    rbx-3.45
    rbx-3.46
    rbx-3.47
    rbx-3.48
    rbx-3.49
    rbx-3.50
    rbx-3.51
    rbx-3.52
    rbx-3.53
    rbx-3.54
    rbx-3.55
    rbx-3.56
    rbx-3.57
    rbx-3.58
    rbx-3.59
    rbx-3.60
    rbx-3.61
    rbx-3.62
    rbx-3.63
    rbx-3.64
    rbx-3.65
    rbx-3.66
    rbx-3.67
    rbx-3.68
    rbx-3.69
    rbx-3.70
    rbx-3.71
    rbx-3.72
    rbx-3.73
    rbx-3.74
    rbx-3.75
    rbx-3.76
    rbx-3.77
    rbx-3.78
    rbx-3.79
    rbx-3.80
    rbx-3.81
    rbx-3.82
    rbx-3.83
    rbx-3.84
    rbx-3.85
    rbx-3.86
    rbx-3.87
    rbx-3.88
    rbx-3.89
    rbx-3.90
    rbx-3.91
    rbx-3.92
    rbx-3.93
    rbx-3.94
    rbx-3.95
    rbx-3.96
    rbx-3.97
    rbx-3.98
    rbx-3.99
    rbx-3.100
    rbx-3.101
    rbx-3.102
    rbx-3.103
    rbx-3.104
    rbx-3.105
    rbx-3.106
    rbx-3.107
    ree-1.8.7-2011.03
    ree-1.8.7-2011.12
    ree-1.8.7-2012.01
    ree-1.8.7-2012.02
    truffleruby-1.0.0-rc10
    truffleruby-1.0.0-rc11
    truffleruby-1.0.0-rc12
    truffleruby-1.0.0-rc13
    truffleruby-1.0.0-rc14
    truffleruby-1.0.0-rc15
    truffleruby-1.0.0-rc16
    truffleruby-1.0.0-rc2
    truffleruby-1.0.0-rc3
    truffleruby-1.0.0-rc5
    truffleruby-1.0.0-rc6
    truffleruby-1.0.0-rc7
    truffleruby-1.0.0-rc8
    truffleruby-1.0.0-rc9
    truffleruby-19.0.0
    truffleruby-19.1.0
    truffleruby-19.2.0
    truffleruby-19.2.0.1
    truffleruby-19.3.0
    
  4. eregon commented on Feb 8, 2020

    @eregon
    Member

    Is it common to have such a .tool-versions but not a .ruby-version?
    I want to make sure I'm not implementing this for just one project, where adding .ruby-version would be a simple workaround.

    Rails seems to add a .ruby-version for instance, so that seems kind of the standard for Ruby applications.

  5. swanson commented on Feb 8, 2020

    @swanson
    Author

    I like using it if you need, for instance, node and ruby in the same project (very common for Rails apps). I actually have both files in my projects at the moment as some tools or editor plugins support only .ruby-version.

    Having both is a bit annoying since its two places to specify the same version, but it's not a huge pain.

  6. niclas-ahden commented on Feb 11, 2020

    @niclas-ahden

    @eregon Yes, it's common to replace .ruby-version with .tools-versions if you want to manage e.g. node and ruby using a single package manger. We recently made the switch in our main repo.

    Thanks for creating setup-ruby. It looks great and we'll start using it 👏

  7. eregon commented on Feb 11, 2020

    @eregon
    Member

    OK, I'll give a shot at supporting .tools-versions when I have some time.

  8. self-assigned this
    on Feb 11, 2020
  9. niclas-ahden commented on Feb 12, 2020

    @niclas-ahden

    Here's my interim hack for the benefit of anyone finding this:

    - name: Get versions from .tool-versions
      id: versions
      run: |
        echo ::set-output name=ruby::$(cat .tool-versions | grep ruby | sed 's/ruby //')
        echo ::set-output name=node::$(cat .tool-versions | grep nodejs | sed 's/nodejs //')
    
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ steps.versions.outputs.ruby }}
    
    
  10. eregon commented on Feb 16, 2020

    @eregon
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions