Skip to content
Set up your GitHub Actions workflow with a specific version of Ruby (by using ruby-build)
JavaScript
Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
dist
src
.eslintrc.json
.gitignore
LICENSE
README.md
action.yml
package-lock.json
package.json

README.md

ruby-build-action

Uses ruby-build to install a Ruby version.

GitHub Actions status

Usage

Pre-requisites

Create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

  • ruby-version - The version of Ruby you want to install
  • cache-available - A flag if a cached Ruby installation is available (see the examples below)

Outputs

  • ruby-path - The path to the Ruby exectuable that was installed

Example workflows

name: Example install of Ruby 2.6.5

on: push

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - uses: clupprich/ruby-build-action@master
      id: ruby
      with:
        ruby-version: 2.6.5
    - name: Print version
      run: ${{ steps.ruby.outputs.ruby-path }} --version

Note that installing Ruby from source is slow. However, you can cache the installation by using the actions/cache action, which is available as a preview right now:

name: Example install of Ruby 2.6.5 (cached)

on: push

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - uses: actions/cache@preview
      id: cache
      with:
        path: ~/local/rubies
        key: ruby-2.6.5
    - uses: clupprich/ruby-build-action@master
      id: ruby
      with:
        ruby-version: 2.6.5
        cache-available: ${{ steps.cache.outputs.cache-hit == 'true' }}
    - name: Print version
      run: ${{ steps.ruby.outputs.ruby-path }} --version

This runs way faster (we still need to install a couple of packages via apt-get install, though): The uncached version takes around 4 minutes to complete, the cached version 30 seconds.

You can’t perform that action at this time.