Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ridk option to disable ridk env variables #562

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ inputs:
Consider the runner as a self-hosted runner, which means not using prebuilt Ruby binaries which only work
on GitHub-hosted runners or self-hosted runners with a very similar image to the ones used by GitHub runners.
The default is to detect this automatically based on the OS, OS version and architecture.
ridk:
description: 'By default, ridk environment variables are added for Windows. For "none", nothing is done.'
outputs:
ruby-prefix:
description: 'The prefix of the installed ruby'
Expand Down
10 changes: 6 additions & 4 deletions dist/index.js

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

4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export async function setupRuby(options = {}) {
const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])

let installer
const installOptions = {}
if (platform.startsWith('windows-') && engine === 'ruby' && !common.isSelfHostedRunner()) {
installer = require('./windows')
installOptions['ridk'] = inputs['ridk']
} else {
installer = require('./ruby-builder')
}
Expand All @@ -70,7 +72,7 @@ export async function setupRuby(options = {}) {
await require('./windows').installJRubyTools()
}

const rubyPrefix = await installer.install(platform, engine, version)
const rubyPrefix = await installer.install(platform, engine, version, installOptions)

await common.measure('Print Ruby version', async () =>
await exec.exec('ruby', ['--version']))
Expand Down
2 changes: 1 addition & 1 deletion ruby-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getAvailableVersions(platform, engine) {
return rubyBuilderVersions[engine]
}

export async function install(platform, engine, version) {
export async function install(platform, engine, version, installOptions) {
let rubyPrefix, inToolCache
if (common.shouldUseToolCache(engine, version)) {
inToolCache = common.toolCacheFind(engine, version)
Expand Down
4 changes: 2 additions & 2 deletions windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getAvailableVersions(platform, engine) {
}
}

export async function install(platform, engine, version) {
export async function install(platform, engine, version, installOptions) {
const url = rubyInstallerVersions[version]

// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
Expand Down Expand Up @@ -90,7 +90,7 @@ export async function install(platform, engine, version) {
}

const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
if (fs.existsSync(ridk)) {
if (fs.existsSync(ridk) && installOptions['ridk'] !== 'none') {
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
}

Expand Down
Loading