mirror of
https://github.com/KevinMidboe/CD.git
synced 2025-10-29 01:20:16 +00:00
Init deploy script for seasoned
This commit is contained in:
36
deploy.sh
Normal file
36
deploy.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
PROJECT_DIR=/home/kevin/seasoned
|
||||
# DEPLOY_DIR=/var/lib/seasoned/
|
||||
|
||||
cd $PROJECT_DIR
|
||||
|
||||
echo "Stashing local changes"
|
||||
git add .
|
||||
git stash
|
||||
|
||||
echo "Pulling from master"
|
||||
git checkout master
|
||||
git pull origin master
|
||||
echo "Pull from master succeeded"
|
||||
|
||||
echo "Installing necessary dependencies"
|
||||
yarn
|
||||
|
||||
echo "Building application"
|
||||
sudo yarn build
|
||||
|
||||
echo "Copy build files to webserver folder"
|
||||
if [ ! -z "$DEPLOY_DIR" ]
|
||||
then
|
||||
printf 'Copying files to %s\n' "$DEPLOY_DIR"
|
||||
sudo cp -R dist $DEPLOY_DIR
|
||||
cd $DEPLOY_DIR
|
||||
fi
|
||||
|
||||
# echo "Setting permissions of dist folder to user 'ubuntu'"
|
||||
# sudo chown -R ubuntu:ubuntu dist
|
||||
|
||||
echo "Restarting webserver"
|
||||
sudo service request restart
|
||||
|
||||
|
||||
Reference in New Issue
Block a user