Skip to content

Commit

Permalink
Fix multiline issue with the shell script. (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zifah authored Aug 5, 2024
1 parent a6df37d commit 39e2eb0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/api-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ jobs:
echo "$SSH_PRIVATE_KEY" > private_key
chmod 600 private_key
rsync -avz --exclude 'appsettings.json' -e "ssh -i private_key -o StrictHostKeyChecking=no" out/ ec2-user@$EC2_INSTANCE_IP:$SERVICE_PATH
ssh -i private_key -o StrictHostKeyChecking=no ec2-user@$EC2_INSTANCE_IP '
sudo systemctl restart $SERVICE_NAME
sleep 3
STATUS=$(sudo systemctl is-active $SERVICE_NAME)
if [ "$STATUS" != "active" ]; then
sudo systemctl status $SERVICE_NAME --no-pager
exit 1
fi
'
ssh -i private_key -o StrictHostKeyChecking=no ec2-user@$EC2_INSTANCE_IP "
sudo systemctl restart $SERVICE_NAME
sleep 1
STATUS=\$(sudo systemctl is-active $SERVICE_NAME)
if [ '\$STATUS\' != 'active' ]; then
sudo systemctl status $SERVICE_NAME --no-pager
exit 1
else
echo 'Service was restarted successfully.'
fi
"
shell: bash

0 comments on commit 39e2eb0

Please sign in to comment.