#!/bin/bash

osOutput=`cat /etc/os-release | grep CentOS`
echo $osOutput
if [ "$osOutput" ]
then
	echo "Jenkins is running on CentOS"
	if ! [ ${BEFORE_DEPLOY_RUN} ]; then
		export BEFORE_DEPLOY_RUN=1;
		npm run build;
		npm prune --production;
		bash ./tools/deploy/bundle.sh;
	fi
	#bash ./tools/deploy/gcs/install_aws_sdk.sh
	exit 0
else
	echo "Jenkins is not running on CentOS"
	osOutput=`cat /etc/os-release | grep Ubuntu`
fi
echo $osOutput
if [ "$osOutput" ]
then
	echo "Jenkins is running on Ubuntu"
	if ! [ ${BEFORE_DEPLOY_RUN} ]; then
		export BEFORE_DEPLOY_RUN=1;
		npm run build;
		npm prune --production;
		bash ./tools/deploy/bundle.sh;
	fi
	bash ./tools/deploy/gcs/install_gc_sdk.sh

else
	echo "Jenkins is not running on Ubuntu"
	exit 1
fi
