Skip to content

Commit

Permalink
ssh check for CD
Browse files Browse the repository at this point in the history
  • Loading branch information
navaneethkrishna30 committed Oct 15, 2024
1 parent 4d72464 commit 8e03d98
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,28 @@ jobs:
run: |
FRONTEND_IMAGE_URI="${{ secrets.FRONTEND_ECR }}:${{ env.IMAGE_TAG }}"
docker build -t $FRONTEND_IMAGE_URI -f ./frontend/Dockerfile ./frontend
docker push $FRONTEND_IMAGE_URI
docker push $FRONTEND_IMAGE_URI
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up environment variables
run: |
echo "BACKEND_ECR=${{ secrets.BACKEND_ECR }}" >> $GITHUB_ENV
echo "FRONTEND_ECR=${{ secrets.FRONTEND_ECR }}" >> $GITHUB_ENV
echo "IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV
- name: Deploy via SSH
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_INSTANCE_IP }}"
export BACKEND_ECR=${{ secrets.BACKEND_ECR }};
export FRONTEND_ECR=${{ secrets.FRONTEND_ECR }};
export IMAGE_TAG=${{ github.sha }};
docker-compose pull;
docker-compose up -d"
env:
BACKEND_ECR: ${{ secrets.BACKEND_ECR }}
FRONTEND_ECR: ${{ secrets.FRONTEND_ECR }}
IMAGE_TAG: ${{ github.sha }}

0 comments on commit 8e03d98

Please sign in to comment.