Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ inputs:
For 'latest', `gem update --system` is run to update to the latest compatible RubyGems version.
Ruby head/master builds will not be updated.
Similarly, if a version number is given, `gem update --system <version>` is run to update to that version of RubyGems, as long as that version is newer than the one provided by default.
setup-script:
description: |
Setup code to be executed after Ruby and Bundler are installed, but before `bundle install` is run.
If you want to execute a script on disk, just pass the filename, like `'./setup.sh'` or `'ruby setup.rb'`
If you intend to use this to install a custom Bundler version or the like, make sure to specify `bundler: none`.
bundler:
description: |
The version of Bundler to install. Either 'Gemfile.lock' (the default), 'default', 'latest', 'none', or a version number (e.g., 1, 2, 2.1, 2.1.4).
Expand Down
10 changes: 10 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const inputDefaults = {
'rubygems': 'default',
'bundler': 'Gemfile.lock',
'bundler-cache': 'false',
'setup-script': '',
'working-directory': '.',
'cache-version': bundler.DEFAULT_CACHE_VERSION,
'self-hosted': 'false',
Expand Down Expand Up @@ -98,6 +99,15 @@ export async function setupRuby(options = {}) {
bundler.installBundler(inputs['bundler'], rubygemsInputSet, lockFile, platform, rubyPrefix, engine, version))
}

if (inputs['setup-script'] !== '') {
await common.measure('Running setup script', async () => {
const lines = inputs['setup-script'].split(/\r?\n/)
for (const line of lines) {
await exec.exec(line)
}
})
}

if (inputs['bundler-cache'] === 'true') {
await common.time('bundle install', async () =>
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
Expand Down