@@ -11,8 +11,8 @@ const warning = (msg) => core.warning(`gh-actions-lua: ${msg}`)
1111
1212const path = require ( "path" )
1313
14- const INSTALL_PREFIX = ".install"
15- const LUA_PREFIX = ".lua"
14+ const BUILD_PREFIX = ".lua-build" // this is a temporary folder where lua will be built
15+ const LUA_PREFIX = ".lua" // this is where Lua will be installed
1616
1717const VERSION_ALIASES = {
1818 "5.1" : "5.1.5" ,
@@ -25,13 +25,13 @@ const VERSION_ALIASES = {
2525const isMacOS = ( ) => ( process . platform || "" ) . startsWith ( "darwin" )
2626
2727async function install_luajit_openresty ( luaInstallPath ) {
28- const installPath = path . join ( process . cwd ( ) , INSTALL_PREFIX )
28+ const buildPath = path . join ( process . env [ "RUNNER_TEMP" ] , BUILD_PREFIX )
2929 const luaCompileFlags = core . getInput ( 'luaCompileFlags' )
3030
31- await io . mkdirP ( installPath )
31+ await io . mkdirP ( buildPath )
3232
3333 await exec . exec ( "git clone https://github.com/openresty/luajit2.git" , undefined , {
34- cwd : installPath
34+ cwd : buildPath
3535 } )
3636
3737 let finalCompileFlags = "-j"
@@ -45,11 +45,11 @@ async function install_luajit_openresty(luaInstallPath) {
4545 }
4646
4747 await exec . exec ( `make ${ finalCompileFlags } ` , undefined , {
48- cwd : path . join ( installPath , "luajit2" )
48+ cwd : path . join ( buildPath , "luajit2" )
4949 } )
5050
5151 await exec . exec ( `make -j install PREFIX="${ luaInstallPath } "` , undefined , {
52- cwd : path . join ( installPath , "luajit2" )
52+ cwd : path . join ( buildPath , "luajit2" )
5353 } )
5454
5555 await exec . exec ( "ln -s luajit lua" , undefined , {
@@ -58,13 +58,13 @@ async function install_luajit_openresty(luaInstallPath) {
5858}
5959
6060async function install_luajit ( luaInstallPath , luajitVersion ) {
61- const luaExtractPath = path . join ( process . cwd ( ) , INSTALL_PREFIX , `LuaJIT-${ luajitVersion } ` )
61+ const luaExtractPath = path . join ( process . env [ "RUNNER_TEMP" ] , BUILD_PREFIX , `LuaJIT-${ luajitVersion } ` )
6262
6363 const luaCompileFlags = core . getInput ( 'luaCompileFlags' )
6464
6565 const luaSourceTar = await tc . downloadTool ( `https://luajit.org/download/LuaJIT-${ luajitVersion } .tar.gz` )
6666 await io . mkdirP ( luaExtractPath )
67- await tc . extractTar ( luaSourceTar , INSTALL_PREFIX )
67+ await tc . extractTar ( luaSourceTar , path . join ( process . env [ "RUNNER_TEMP" ] , BUILD_PREFIX )
6868
6969 let finalCompileFlags = "-j"
7070
@@ -90,12 +90,12 @@ async function install_luajit(luaInstallPath, luajitVersion) {
9090}
9191
9292async function install_plain_lua ( luaInstallPath , luaVersion ) {
93- const luaExtractPath = path . join ( process . cwd ( ) , INSTALL_PREFIX , `lua-${ luaVersion } ` )
93+ const luaExtractPath = path . join ( process . env [ "RUNNER_TEMP" ] , BUILD_PREFIX , `lua-${ luaVersion } ` )
9494 const luaCompileFlags = core . getInput ( 'luaCompileFlags' )
9595
9696 const luaSourceTar = await tc . downloadTool ( `https://www.lua.org/ftp/lua-${ luaVersion } .tar.gz` )
9797 await io . mkdirP ( luaExtractPath )
98- await tc . extractTar ( luaSourceTar , INSTALL_PREFIX )
98+ await tc . extractTar ( luaSourceTar , path . join ( process . env [ "RUNNER_TEMP" ] , BUILD_PREFIX ) )
9999
100100 if ( isMacOS ( ) ) {
101101 await exec . exec ( "brew install readline ncurses" )
0 commit comments