Skip to content
Latchkey

ruby/setup-ruby: Install Ruby & Bundler in CI

setup-ruby installs Ruby and can run bundler with caching in a single step.

Pin a Ruby version or read .ruby-version. Set bundler-cache: true and the action runs bundle install and caches gems for you.

Key inputs (with:)

  • ruby-version: e.g. 3.3 or .ruby-version.
  • bundler-cache: true to run bundle install with caching.
  • bundler: pin a Bundler version.
  • working-directory: where the Gemfile lives.

Example workflow

.github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3'
          bundler-cache: true
      - run: bundle exec rake

On any runner

setup-ruby runs on any runner. Latchkey managed runners run it unchanged.

Key takeaways

  • bundler-cache: true replaces a manual bundle install plus cache.
  • ruby-version: .ruby-version keeps CI aligned with local.
  • Set working-directory for monorepos with nested Gemfiles.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →