Merge pull request #29 from palloberg/master

Make it work on self-hosted runners without Java installed
This commit is contained in:
Kirill Chernyshov 2021-05-31 21:49:34 +02:00 committed by GitHub
commit 28c1e37e17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 10 deletions

View File

@ -83,7 +83,8 @@ jobs:
java-version: 1.8
- name: Install leiningen
uses: DeLaGuardo/setup-clojure@master
# uses: DeLaGuardo/setup-clojure@master
uses: ./
with:
lein: 2.9.1
@ -108,7 +109,8 @@ jobs:
java-version: 1.8
- name: Install boot
uses: DeLaGuardo/setup-clojure@master
# uses: DeLaGuardo/setup-clojure@master
uses: ./
with:
boot: 2.8.3

19
dist/index.js vendored
View File

@ -1561,6 +1561,12 @@ function installBoot(binScript, destinationFolder, version) {
BOOT_VERSION: version
};
}
if (process.env['PATH']) {
env['PATH'] = process.env['PATH'];
}
if (process.env['JAVA_CMD']) {
env['JAVA_CMD'] = process.env['JAVA_CMD'];
}
yield exec.exec(`./boot ${version === 'latest' ? '-u' : '-V'}`, [], {
cwd: path.join(destinationFolder, 'boot', 'bin'),
env
@ -3372,11 +3378,18 @@ function installLeiningen(binScript, destinationFolder) {
const version_cmd = IS_WINDOWS
? 'powershell .\\lein.ps1 self-install'
: './lein version';
let env = {
LEIN_HOME: path.join(destinationFolder, 'leiningen'),
};
if (process.env['PATH']) {
env['PATH'] = process.env['PATH'];
}
if (process.env['JAVA_CMD']) {
env['JAVA_CMD'] = process.env['JAVA_CMD'];
}
yield exec.exec(version_cmd, [], {
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
env: {
LEIN_HOME: path.join(destinationFolder, 'leiningen')
}
env: env
});
return path.join(destinationFolder, 'leiningen');
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -74,7 +74,7 @@ async function installBoot(
await io.mv(bin, path.join(binDir, `boot`))
fs.chmodSync(path.join(binDir, `boot`), '0755')
let env = {}
let env: {[key: string]: string} = {};
if (version === 'latest') {
env = {
BOOT_HOME: path.join(destinationFolder, 'boot')
@ -86,6 +86,13 @@ async function installBoot(
}
}
if (process.env['PATH']) {
env['PATH'] = process.env['PATH']
}
if (process.env['JAVA_CMD']) {
env['JAVA_CMD'] = process.env['JAVA_CMD']
}
await exec.exec(`./boot ${version === 'latest' ? '-u' : '-V'}`, [], {
cwd: path.join(destinationFolder, 'boot', 'bin'),
env

View File

@ -65,11 +65,20 @@ async function installLeiningen(
? 'powershell .\\lein.ps1 self-install'
: './lein version'
let env: {[key: string]: string} = {
LEIN_HOME: path.join(destinationFolder, 'leiningen'),
}
if (process.env['PATH']) {
env['PATH'] = process.env['PATH']
}
if (process.env['JAVA_CMD']) {
env['JAVA_CMD'] = process.env['JAVA_CMD']
}
await exec.exec(version_cmd, [], {
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
env: {
LEIN_HOME: path.join(destinationFolder, 'leiningen')
}
env: env
})
return path.join(destinationFolder, 'leiningen')