GitHub workflows: latest Ruby version

At the moment, Ruby 3.0.2 is the current version of Ruby. Eventually, the current version will be 3.0.3 instead. At some point later in time, version 3.1.0 will be current, then 3.1.1, and so on.

Is there anything I can do in GitHub workflows that makes it possible to AUTOMATICALLY update the Ruby version used so that i don’t have to edit the source code every time Ruby is updated? The idea is to specify “latest” instead of having to specify “3.0.2” and then manually update it regularly.

I use the ruby/setup-ruby action. It can read the ruby version from a .ruby_version file. This way you can ensure that your development, ci and production environment all use the same ruby version.

1 Like