Skip to content

Teste local

Teste local #1

Workflow file for this run

name: Build and Push Docker Image to AWS ECR
on:
pull_request:
branches: [ main, hmg ]
types: closed
jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
strategy:
matrix:
environment:
- { name: "homologation", branch: "hmg", repository: "vagas-hmg" }
- { name: "production", branch: "main", repository: "vagas" }
name: Deploy to ${{ matrix.environment.name }}
steps:
- name: Check branch match
id: branch_check
run: |
if [[ "${{ github.base_ref }}" != "${{ matrix.environment.branch }}" ]]; then
exit 1
fi
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, Tag, and Push the Image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ matrix.environment.repository }}
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG