Files
maestro/.github/workflows/deploy.yml
T
2022-02-04 10:20:45 -03:00

47 lines
1.2 KiB
YAML

name: Deploy
on:
push:
branches:
- dev
- stg
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- 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:
aws-region: us-east-1
- name: Install AWS CLI
run: |
python3 -m pip install awscli
- name: Login to AWS ECR
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, Tag, and Push Image to AWS ECR
env:
ECR_REGISTRY: ${{ steps.login_ecr.outputs.registry }}
ECR_REPOSITORY: microservices/maestro_${{ steps.extract_environment.outputs.result }}
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG