Skip to content

Commit 567c18d

Browse files
Merge pull request #32 from brandonnorsworthy/deployments
stop all processes
2 parents 069e15c + 83ceb4e commit 567c18d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/cicd-dev.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,27 @@ jobs:
5454
run: |
5555
scp -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ./dist.tar.gz ${{ secrets.EC2_USER }}@${{ secrets.EC2_IP }}:/home/ec2-user/
5656
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_IP }} << 'EOF'
57-
pm2 start --name app "npx serve -s -l 3000"
5857
set -e
58+
59+
# Stop the running PM2 app
60+
pm2 stop app
61+
62+
# Navigate to the home directory and prepare the deployment
5963
cd /home/ec2-user
6064
sudo rm -rf /var/www/vite-app
6165
sudo mkdir -p /var/www/vite-app
66+
67+
# Move and extract the new build
6268
sudo mv dist.tar.gz /var/www/vite-app/
6369
cd /var/www/vite-app
6470
sudo tar -xzvf dist.tar.gz
71+
72+
# Set the correct permissions
6573
sudo chown -R nginx:nginx /var/www/vite-app
74+
75+
# Restart Nginx to serve the new build
6676
sudo systemctl restart nginx
77+
78+
# Start the PM2 app with the updated content
79+
pm2 start --name app "npx serve -s -l 3000"
6780
EOF

0 commit comments

Comments
 (0)