Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kpavlovsky/29de1dd4af6a6c2e5dadc1e1991eaa4c to your computer and use it in GitHub Desktop.
Save kpavlovsky/29de1dd4af6a6c2e5dadc1e1991eaa4c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ -z "${STAGE_PRIVATE_KEY}" ]; then echo "STAGE_PRIVATE_KEY is not set"; exit 255; fi
if [ -z "${STAGE_PUBLIC_KEY}" ]; then echo "STAGE_PRIVATE_KEY is not set"; exit 255; fi
pwd
ls
id
mkdir ~/.ssh/
echo -n "$STAGE_PRIVATE_KEY" > ~/.ssh/id_rsa
echo -n "$STAGE_PUBLIC_KEY" > ~/.ssh/id_rsa.pub
echo "Key permissions"
chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/*
echo "Adding to known hosts"
ssh-keyscan -p9999 SERVER >> ~/.ssh/known_hosts
echo "cat ~/.ssh/known_hosts:"
cat ~/.ssh/known_hosts
echo "switching to interface dir"
cd interface
echo "npm -g i"
npm -g i
echo "rm -rf -dist"
rm -rf dist
echo "ng build -e ru_prod --prod"
ng build -e ru_prod --prod
echo "scp -P 9999 -r dist/* sites@SERVER:/sites/sitename/web_ru"
scp -P 9999 -r dist/* sites@SERVER:/sites/sitename/web_ru
echo "ng build -e ru_prod --prod"
rm -rf dist
echo "ng build -e en_prod --prod"
ng build -e en_prod --prod
echo "scp -P 9999 -r dist/* sites@SERVER:/sites/sitename/web_en"
scp -P 9999 -r dist/* sites@SERVER:/sites/sitename/web_en
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment