Skip to content

Commit

Permalink
Mark 1 Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
code-wolf-byte committed Aug 31, 2024
1 parent 5cdeaf4 commit 8e33864
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions CD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ BRANCH="main" # Change this to the branch you want to pull
echo "Starting deployment..."

# Navigate to the repository directory
cd $REPO_DIR || exit
cd $REPO_DIR || { echo "Failed to navigate to $REPO_DIR"; exit 1; }

# Pull the latest changes from the repository
echo "Pulling the latest changes from the repository..."
git fetch origin $BRANCH
git reset --hard origin/$BRANCH
git fetch origin $BRANCH || { echo "Failed to fetch branch $BRANCH"; exit 1; }
git reset --hard origin/$BRANCH || { echo "Failed to reset to origin/$BRANCH"; exit 1; }

# Install dependencies
echo "Installing dependencies..."
npm install
npm install || { echo "Failed to install dependencies"; exit 1; }

# Build the project
echo "Building the project..."
npm run build
npm run build || { echo "Failed to build the project"; exit 1; }

# Restart the React website service
echo "Restarting the React website service..."
sudo systemctl daemon-reload
sudo systemctl restart react-website.service
sudo systemctl daemon-reload || { echo "Failed to reload systemd"; exit 1; }
sudo systemctl restart react-website.service || { echo "Failed to restart react-website.service"; exit 1; }
sudo systemctl enable react-website.service || { echo "Failed to enable react-website.service"; exit 1; }

# Check the status of the service
echo "Checking the status of the React website service..."
sudo systemctl status react-website.service --no-pager
sudo systemctl status react-website.service --no-pager || { echo "React website service is not running"; exit 1; }

echo "Deployment complete. Website should be hosted on http://localhost:3000"

0 comments on commit 8e33864

Please sign in to comment.