Install OTP on Windows to a local directory (#139)

This commit is contained in:
Wojtek Mach
2022-09-12 16:40:00 +02:00
committed by GitHub
parent ee0fa0b672
commit 7dd0d763a8
6 changed files with 12 additions and 40 deletions
+1 -10
View File
@@ -7173,7 +7173,6 @@ const { exec } = __nccwpck_require__(1514)
const path = __nccwpck_require__(1017)
const semver = __nccwpck_require__(1383)
const https = __nccwpck_require__(5687)
const fs = __nccwpck_require__(7147)
const installer = __nccwpck_require__(2127)
main().catch((err) => {
@@ -7218,15 +7217,7 @@ async function installOTP(otpSpec, osVersion) {
)
await installer.installOTP(osVersion, otpVersion)
core.setOutput('otp-version', otpVersion)
if (process.platform === 'linux') {
core.addPath(`${process.env.RUNNER_TEMP}/.setup-beam/otp/bin`)
} else if (process.platform === 'win32') {
const otpPath = fs.readFileSync(`${process.env.RUNNER_TEMP}/otp_path.txt`, {
encoding: 'utf8',
flag: 'r',
})
core.addPath(otpPath)
}
core.addPath(`${process.env.RUNNER_TEMP}/.setup-beam/otp/bin`)
console.log('##[endgroup]')
return otpVersion
+4 -9
View File
@@ -5,18 +5,13 @@ $ErrorActionPreference="Stop"
Set-Location ${Env:RUNNER_TEMP}
$FILE_OUTPUT="otp.exe"
$DIR_FOR_BIN=".setup-beam/otp"
$ERL_ROOT = "${Env:RUNNER_TEMP}\.setup-beam\otp"
$ProgressPreference="SilentlyContinue"
Invoke-WebRequest "https://github.com/erlang/otp/releases/download/OTP-${VSN}/otp_win64_${VSN}.exe" -OutFile "${FILE_OUTPUT}"
$ProgressPreference="Continue"
New-Item "${DIR_FOR_BIN}" -ItemType Directory | Out-Null
Move-Item "${FILE_OUTPUT}" "${DIR_FOR_BIN}"
Start-Process "./${DIR_FOR_BIN}/${FILE_OUTPUT}" /S -Wait
$ErlExec = Get-ChildItem -Path "C:/Program Files/" -Recurse -Depth 2 -Filter 'erl.exe' -Name | ForEach-Object { Write-Output "C:/Program Files/$_" }
$ErlPath = Split-Path -Path "${ErlExec}"
Write-Output "${ErlPath}" | Out-File -FilePath otp_path.txt -Encoding utf8 -NoNewline
Start-Process "${FILE_OUTPUT}" "/S /D=${ERL_ROOT}" -Wait
Write-Output "Installed Erlang/OTP version follows"
& "${ErlPath}/erl.exe" "+V" | Write-Output
& "${ERL_ROOT}/bin/erl.exe" "+V" | Write-Output
"INSTALL_DIR_FOR_OTP="+(Get-Item ${ErlPath}).parent.FullName | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
"INSTALL_DIR_FOR_OTP=" + ${ERL_ROOT}
+1 -1
View File
@@ -17,4 +17,4 @@ tar zxf "${FILE_OUTPUT}" -C "${DIR_FOR_BIN}" --strip-components=1
echo "Installed Erlang/OTP version follows"
${DIR_FOR_BIN}/bin/erl -version
echo "INSTALL_DIR_FOR_OTP=${RUNNER_TEMP}/${DIR_FOR_BIN}" >> "${GITHUB_ENV}"
echo "INSTALL_DIR_FOR_OTP=${RUNNER_TEMP}/${DIR_FOR_BIN}"