Skip to content

Commit

Permalink
Update aws-deployment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AdleeAfif authored Apr 16, 2024
1 parent e94c0ef commit f166723
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/aws-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
EC2_PUBLIC_IP: ${{ secrets.EC2_PUBLIC_IP }}
EC2_USERNAME: ${{ secrets.EC2_USERNAME }}
EC2_KEY_PAIR: ${{ secrets.EC2_KEY_PAIR }}
DEPLOY_PATH: /home/ec2-user/portfolio-app
DEPLOY_PATH: /home/ec2-user/

steps:
- name: Checkout code
Expand Down Expand Up @@ -56,10 +56,10 @@ jobs:
echo "${{ secrets.EC2_KEY_PAIR }}" > ec2_key.pem
chmod 600 ec2_key.pem
ls
scp -i ec2_key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r portfolio-app/. ${{ env.EC2_USERNAME }}@${{ env.EC2_PUBLIC_IP }}:${{ env.DEPLOY_PATH }}
scp -i ec2_key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r ./ ${{ env.EC2_USERNAME }}@${{ env.EC2_PUBLIC_IP }}:${{ env.DEPLOY_PATH }}/portfolio-app

# Restart the application on EC2 using pm2
ssh -i ec2_key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${{ env.EC2_USERNAME }}@${{ env.EC2_PUBLIC_IP }} "cd ${{ env.DEPLOY_PATH }} && pm2 restart portfolio-app"
ssh -i ec2_key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${{ env.EC2_USERNAME }}@${{ env.EC2_PUBLIC_IP }} "cd ${{ env.DEPLOY_PATH }}/portfolio-app && pm2 restart portfolio-app"

# Cleanup
rm ec2_key.pem

0 comments on commit f166723

Please sign in to comment.