diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 64a859e..7c153af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,6 @@ jobs: # Use various version syntaxes here for testing ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby ] exclude: - - os: windows-latest - ruby: jruby - os: windows-latest ruby: truffleruby runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 57ed752..99ca580 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,6 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti | macOS | `macos-latest` | | Windows | `windows-latest` | -JRuby and TruffleRuby are not yet supported on `windows-latest`. - The prebuilt rubies are generated by [eregon/ruby-install-builder](https://github.com/eregon/ruby-install-builder) and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2). The full list of available Ruby versions can be seen at [versions.json](https://github.com/eregon/ruby-install-builder/blob/metadata/versions.json) diff --git a/dist/index.js b/dist/index.js index 54f3e15..6010abf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1386,14 +1386,15 @@ const core = __webpack_require__(470) async function run() { try { const platform = getVirtualEnvironmentName() + const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) + let installer - if (platform === 'windows-latest') { + if (platform === 'windows-latest' && engine !== 'jruby') { installer = __webpack_require__(826) } else { installer = __webpack_require__(442) } - const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) const engineVersions = await installer.getAvailableVersions(engine) const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version) @@ -4847,6 +4848,8 @@ function escape(s) { __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); +const os = __webpack_require__(87) +const path = __webpack_require__(622) const core = __webpack_require__(470) const io = __webpack_require__(1) const tc = __webpack_require__(533) @@ -4864,12 +4867,12 @@ async function getAvailableVersions(engine) { async function install(platform, ruby) { const rubyPrefix = await downloadAndExtract(platform, ruby) - core.addPath(`${rubyPrefix}/bin`) + core.addPath(path.join(rubyPrefix, 'bin')) return rubyPrefix } async function downloadAndExtract(platform, ruby) { - const rubiesDir = `${process.env.HOME}/.rubies` + const rubiesDir = path.join(os.homedir(), '.rubies') await io.mkdirP(rubiesDir) const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz` @@ -4878,7 +4881,7 @@ async function downloadAndExtract(platform, ruby) { const downloadPath = await tc.downloadTool(url) await tc.extractTar(downloadPath, rubiesDir) - return `${rubiesDir}/${ruby}` + return path.join(rubiesDir, ruby) } diff --git a/index.js b/index.js index 9e12fa2..bd890fe 100644 --- a/index.js +++ b/index.js @@ -5,14 +5,15 @@ const core = require('@actions/core') async function run() { try { const platform = getVirtualEnvironmentName() + const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) + let installer - if (platform === 'windows-latest') { + if (platform === 'windows-latest' && engine !== 'jruby') { installer = require('./windows') } else { installer = require('./ruby-install-builder') } - const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) const engineVersions = await installer.getAvailableVersions(engine) const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version) diff --git a/ruby-install-builder.js b/ruby-install-builder.js index d390f15..ac60a0c 100644 --- a/ruby-install-builder.js +++ b/ruby-install-builder.js @@ -1,3 +1,5 @@ +const os = require('os') +const path = require('path') const core = require('@actions/core') const io = require('@actions/io') const tc = require('@actions/tool-cache') @@ -15,12 +17,12 @@ export async function getAvailableVersions(engine) { export async function install(platform, ruby) { const rubyPrefix = await downloadAndExtract(platform, ruby) - core.addPath(`${rubyPrefix}/bin`) + core.addPath(path.join(rubyPrefix, 'bin')) return rubyPrefix } async function downloadAndExtract(platform, ruby) { - const rubiesDir = `${process.env.HOME}/.rubies` + const rubiesDir = path.join(os.homedir(), '.rubies') await io.mkdirP(rubiesDir) const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz` @@ -29,5 +31,5 @@ async function downloadAndExtract(platform, ruby) { const downloadPath = await tc.downloadTool(url) await tc.extractTar(downloadPath, rubiesDir) - return `${rubiesDir}/${ruby}` + return path.join(rubiesDir, ruby) }