Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ const createProcfile = ({ procfile, appdir }) => {
}
};

const getBranchViaRegex = (branch) => {
if (!branch) return branch;

try {
let branchName = execSync(
'git branch -a | grep -m 1 "' + branch + '"'
).toString();

if (!!branchName) {
branchName = branchName.replace('*', '').trim();
return branchName;
}
} catch(e) {
console.error('No branch found');
}

return branch;
}

const deploy = ({
dontuseforce,
app_name,
Expand All @@ -72,6 +91,7 @@ const deploy = ({
dockerBuildArgs,
appdir,
}) => {
branch = getBranchViaRegex(branch);
const force = !dontuseforce ? "--force" : "";
if (usedocker) {
execSync(
Expand Down