-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·48 lines (38 loc) · 1.05 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# deploy.sh used to send build files to the server
set -e
# Get updates from repo
echo "Getting updates from the repository..."
git reset --hard HEAD
git pull
# Update packages from node
echo "Uploading packages from node..."
npm install
# Build the Angular project
echo "Building the Angular project..."
FILE="angular.json"
sed -i '41 i\ "externalDependencies": ["jsdom"],' $FILE
ng build
sed -i '41d' $FILE
# Removing previous files
DIR=~/htdocs/typecircle.com
# Check if the directory exists
if [ -d "$DIR" ]; then
# Check if the directory is empty
if [ "$(ls -A $DIR)" ]; then
echo "Removing previous files from typecircle.com..."
rm -r "$DIR"/*
echo "Files removed."
else
echo "Directory is empty, nothing to remove."
fi
else
echo "Directory does not exist."
fi
# Copy files to destination directory
echo "Copying files to typecircle.com ..."
cp -r dist/type-circle/browser/* "$DIR"
# Remove temporary files
echo "Removing temporary files..."
rm -r dist .angular
echo "Deploy completed successfully!"