Skip to content

Commit 2bcd9af

Browse files
committed
Check Composer global bin for Deployer
1 parent a1b46c2 commit 2bcd9af

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

dist/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36674,11 +36674,19 @@ async function dep() {
3667436674
const subDirectory = getInput("sub-directory").trim();
3667536675
if (subDirectory !== "") cd(subDirectory);
3667636676
if (bin === "") {
36677-
for (const c of [
36677+
const candidates = [
3667836678
"vendor/bin/deployer.phar",
3667936679
"vendor/bin/dep",
3668036680
"deployer.phar"
36681-
]) if (fs.existsSync(c)) {
36681+
];
36682+
try {
36683+
const composerHome = (await $`composer -n config --global home`).stdout.trim();
36684+
if (composerHome !== "") {
36685+
candidates.push(`${composerHome}/vendor/bin/deployer.phar`);
36686+
candidates.push(`${composerHome}/vendor/bin/dep`);
36687+
}
36688+
} catch (_) {}
36689+
for (const c of candidates) if (fs.existsSync(c)) {
3668236690
bin = c;
3668336691
console.log(`Using "${c}".`);
3668436692
break;

src/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,23 @@ async function dep(): Promise<void> {
7171
}
7272

7373
if (bin === '') {
74-
for (const c of [
74+
const candidates = [
7575
'vendor/bin/deployer.phar',
7676
'vendor/bin/dep',
7777
'deployer.phar',
78-
]) {
78+
]
79+
80+
try {
81+
const composerHome = (await $`composer -n config --global home`).stdout.trim()
82+
if (composerHome !== '') {
83+
candidates.push(`${composerHome}/vendor/bin/deployer.phar`)
84+
candidates.push(`${composerHome}/vendor/bin/dep`)
85+
}
86+
} catch (_) {
87+
// Composer may not be installed or configured. Fall back to local checks.
88+
}
89+
90+
for (const c of candidates) {
7991
if (fs.existsSync(c)) {
8092
bin = c
8193
console.log(`Using "${c}".`)

0 commit comments

Comments
 (0)