Skip to content

Commit

Permalink
Fix deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvarwow69 committed Nov 3, 2022
1 parent 03bfe46 commit 0421a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ci/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ function isWorkflowEnd(req, name)
return false;
}

function canDeploy(req, name, callback)
function canDeploy(req, name)
{
if (isWorkflowEnd(req, name))
{
const branch = req.body.workflow_run.head_branch;
if (branch === Process.env.CI_BRANCH) {
console.log(prefix(name) + "Starting deploying with branch " + branch + "...");
callback();
return true;
}
}
Expand All @@ -55,17 +54,18 @@ app.post('/payload', (req, res) => {
const name = req.body.repository.name;
const port = 8080;

canDeploy(req, name, () => { console.log("Nothing to deploy it's just a test!")
if (canDeploy(req, name)) {
exec("./ci/script/deploy.sh naboo dev " + port, (error, stdout, stderr) => {
if (error)
console.log(`error: ${error.message}`);
else if (stderr)
console.log(`stderr: ${stderr}`);
else
console.log(`stdout: ${stdout}`);
});});
});
}
res.status(200).send();
});
})

app.post('/ci_deploy', (req, res) => {
console.info(prefix("ARKultur") + "Endpoint: /ci_deploy targeted");
Expand Down
2 changes: 1 addition & 1 deletion ci/script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#$3 -> Port for the machine and the image

PREFIX="[ARKultur] "
REPO="arkulturtest"
REPO="bogdzn"

if [ "$( docker container inspect -f '{{.State.Running}}' $1 )" == "true" ];
then
Expand Down

0 comments on commit 0421a85

Please sign in to comment.