From 83b8ed0eba339b79d7aeb3d7289226fc0935f9d1 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sun, 28 Jan 2024 16:55:16 +0000 Subject: [PATCH] Fix exposed INSTALL_DIR_FOR_${toolName} variables We're missing the /bin --- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 2 +- dist/index.js | 15 +++++++++------ src/setup-beam.js | 15 +++++++++------ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 8b3df49d..cf103849 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -197,7 +197,7 @@ jobs: gleam-version: ${{matrix.combo.gleam-version}} rebar3-version: ${{matrix.combo.rebar3-version}} - run: env - - name: List environment variables + - name: Check environment variables run: | ${INSTALL_DIR_FOR_ELIXIR}/elixir --version ${INSTALL_DIR_FOR_GLEAM}/gleam --version diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1c2ea140..fff422cb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -135,7 +135,7 @@ jobs: gleam-version: ${{matrix.combo.gleam-version}} rebar3-version: ${{matrix.combo.rebar3-version}} - run: env - - name: List environment variables + - name: Check environment variables run: | ${INSTALL_DIR_FOR_ELIXIR}/elixir --version ${INSTALL_DIR_FOR_GLEAM}/gleam --version diff --git a/dist/index.js b/dist/index.js index 0ab92cb2..76853d92 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10723,16 +10723,18 @@ async function install(toolName, opts) { postExtract: async (cachePath) => { const bindir = path.join(cachePath, 'bin') const oldPath = path.join(cachePath, 'rebar3') + const newPath = path.join(bindir, 'rebar3') fs.mkdirSync(bindir) - fs.chmodSync(oldPath, 0o755) + fs.renameSync(oldPath, newPath) + fs.chmodSync(newPath, 0o755) const ps1Filename = path.join(bindir, 'rebar3.ps1') - fs.writeFileSync(ps1Filename, `& escript.exe ${oldPath} \${args}`) + fs.writeFileSync(ps1Filename, `& escript.exe ${newPath} \${args}`) const cmdFilename = path.join(bindir, 'rebar3.cmd') fs.writeFileSync( cmdFilename, - `@echo off\r\nescript.exe ${oldPath} %*`, + `@echo off\r\nescript.exe ${newPath} %*`, ) }, reportVersion: () => { @@ -10776,11 +10778,12 @@ async function installTool(opts) { await platformOpts.postExtract(cachePath) core.debug(`Adding ${cachePath}'s bin to system path`) - core.addPath(path.join(cachePath, 'bin')) + const catchPathBin = path.join(cachePath, 'bin') + core.addPath(catchPathBin) const installDirForVarName = `INSTALL_DIR_FOR_${toolName}`.toUpperCase() - core.debug(`Exporting ${installDirForVarName} as ${cachePath}`) - core.exportVariable(installDirForVarName, cachePath) + core.debug(`Exporting ${installDirForVarName} as ${catchPathBin}`) + core.exportVariable(installDirForVarName, catchPathBin) core.info(`Installed ${installOpts.tool} version`) const [cmd, args] = platformOpts.reportVersion() diff --git a/src/setup-beam.js b/src/setup-beam.js index ce698350..b7f42355 100644 --- a/src/setup-beam.js +++ b/src/setup-beam.js @@ -903,16 +903,18 @@ async function install(toolName, opts) { postExtract: async (cachePath) => { const bindir = path.join(cachePath, 'bin') const oldPath = path.join(cachePath, 'rebar3') + const newPath = path.join(bindir, 'rebar3') fs.mkdirSync(bindir) - fs.chmodSync(oldPath, 0o755) + fs.renameSync(oldPath, newPath) + fs.chmodSync(newPath, 0o755) const ps1Filename = path.join(bindir, 'rebar3.ps1') - fs.writeFileSync(ps1Filename, `& escript.exe ${oldPath} \${args}`) + fs.writeFileSync(ps1Filename, `& escript.exe ${newPath} \${args}`) const cmdFilename = path.join(bindir, 'rebar3.cmd') fs.writeFileSync( cmdFilename, - `@echo off\r\nescript.exe ${oldPath} %*`, + `@echo off\r\nescript.exe ${newPath} %*`, ) }, reportVersion: () => { @@ -956,11 +958,12 @@ async function installTool(opts) { await platformOpts.postExtract(cachePath) core.debug(`Adding ${cachePath}'s bin to system path`) - core.addPath(path.join(cachePath, 'bin')) + const catchPathBin = path.join(cachePath, 'bin') + core.addPath(catchPathBin) const installDirForVarName = `INSTALL_DIR_FOR_${toolName}`.toUpperCase() - core.debug(`Exporting ${installDirForVarName} as ${cachePath}`) - core.exportVariable(installDirForVarName, cachePath) + core.debug(`Exporting ${installDirForVarName} as ${catchPathBin}`) + core.exportVariable(installDirForVarName, catchPathBin) core.info(`Installed ${installOpts.tool} version`) const [cmd, args] = platformOpts.reportVersion()