Skip to content

Commit

Permalink
feat: add conditional environment for action
Browse files Browse the repository at this point in the history
  • Loading branch information
prakashchoudhary07 committed Jun 4, 2024
1 parent fab1c04 commit 134b132
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/deploy-to-ec2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ name: Deploy to EC2
on:
push:
branches:
- main
- develop
- feat/aws-deploy # Remove before merting this PR to dev

jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 10
environment: staging
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}

steps:
- name: Checkout Repository
Expand Down Expand Up @@ -43,7 +44,7 @@ jobs:
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }}
key: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }}
script: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
docker stop ${{ github.event.repository.name }}-${{ vars.ENV }} || true
Expand Down

0 comments on commit 134b132

Please sign in to comment.