diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 82f0425..80cd6b4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,6 +2,8 @@ name: Deploy on: push: branches: + - dev + - stg - main jobs: @@ -11,6 +13,16 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Extract Environment + shell: bash + run: | + if [ ${GITHUB_REF} == "refs/heads/main" ]; then + echo "##[set-output name=result;]$(echo "prd")" + else + echo "##[set-output name=result;]$(echo ${GITHUB_REF#refs/heads/})" + fi + id: extract_environment + - name: Configure AWS Region uses: aws-actions/configure-aws-credentials@v1 with: @@ -27,7 +39,7 @@ jobs: - name: Build, Tag, and Push Image to AWS ECR env: ECR_REGISTRY: ${{ steps.login_ecr.outputs.registry }} - ECR_REPOSITORY: microservices/maestro + ECR_REPOSITORY: microservices/maestro_${{ steps.extract_environment.outputs.result }} IMAGE_TAG: latest run: | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .