Git-Auto-Deploy icon indicating copy to clipboard operation
Git-Auto-Deploy copied to clipboard

How to display deploy script output inside main output window

Open yashilanka opened this issue 7 years ago • 1 comments

Hi i create a Post-Deploy Script and it contain node js commands like npm install and so on. i want to display that nodejs command output to main script output area. i want to know is it possible to do, if yes can you guide me how to do it correctly this is my bash file.

i'm new to shell, know some stuff, but not a super user 👍

Conf File

please check my deploy value, this is i thought but it didn't work :(

{
//  "pidfilepath": "/var/run/git-auto-deploy/git-auto-deploy.pid",
  "logfilepath": "/var/log/git-auto-deploy.log",
  "host": "0.0.0.0",
  "port": 8080,
  "repositories": [
    {
      "url": "[email protected]:****/***.git",
      "branch": "master",
      "remote": "origin",
      "path": "~/repositories/***",
      "deploy": "chmod u+x post-install.sh && bash -x post-install.sh < /dev/tty",
      "secret-token" : "************"
    }
  ]
}

Post-Deploy bash script

#!/bin/bash -x
cwd=$(pwd);
sudo apt-get install build-essential g++ -y

if [ ! -d "$cwd/node_modules" ]; then
  echo "Node packages not found, installation started !!!"
  sudo npm install -g node-gyp  && sudo npm install --unsafe-perm node-sass -g;
  npm install bower -g  && npm install gulp -g && npm install marked -g && npm install mimer -g && npm install ttf2woff2 -g && npm install varstream -g && npm install svgicons2svgfont -g;
  npm install;
fi

if [ ! -d "$cwd/bower_components" ]; then
  echo "Bower packages not found, installation started !!!"
  bower install --allow-root;
fi

while inotifywait -q -e modify "$cwd/bower.json"; do
    echo "New Package Detected on bower.json and bower is now installing";
    rm -rf cwd/bower_components;
    npm install bower -g;
    bower cache clean;
    bower install --allow-root;
done

while inotifywait -q -e modify "$cwd/package.json"; do
    echo "New Package Detected on package.json and node is now installing";
    rm -rf cwd/node_modules;
    npm cache clean;
    npm install;
done

if [ -d "$cwd/build" ]; then
  echo "Re-run Build Process"
  rm -rf cwd/build;
  npm run build-cli;
  exit;
else
  npm run build-cli;
  exit;
fi


yashilanka avatar Sep 16 '16 23:09 yashilanka