Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Latest commit

 

History

History
73 lines (51 loc) · 2.2 KB

README.md

File metadata and controls

73 lines (51 loc) · 2.2 KB

DEPRECATED - Please use https://github.com/ruby/setup-ruby instead

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.