Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizCampedelli authored Sep 6, 2024
1 parent 77a4a4e commit 718f7a4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ jobs:
# Install git if not already installed
sudo yum install -y git || sudo apt-get install -y git
# Clone the repository if .git directory doesn't exist, otherwise pull latest changes
if [ ! -d ".git" ]; then
git clone https://github.com/LuizCampedelli/Projeto_Api_Pet_ADA_Final.git .
else
git pull origin main
# Check if the directory is already a git repository
if [ -d ".git" ]; then
echo "Existing repository found, removing it..."
rm -rf /home/ec2-user/app/*
fi
# Clone the repository again
git clone https://github.com/LuizCampedelli/Projeto_Api_Pet_ADA_Final.git .
# Ensure virtual environment exists, create if not
if [ ! -d "/home/ec2-user/myenv" ]; then
python3 -m venv /home/ec2-user/myenv
Expand All @@ -57,9 +59,9 @@ jobs:
# Activate virtual environment
. /home/ec2-user/myenv/bin/activate
# Install requirements
pip install --upgrade pip
# Install requirements if requirements.txt exists
if [ -f requirements.txt ]; then
pip install --upgrade pip
pip install -r requirements.txt
else
echo "requirements.txt file not found!"
Expand Down

0 comments on commit 718f7a4

Please sign in to comment.