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

51 lines
1.1 KiB
YAML

name: Deploy
on:
push:
branches:
- dev
- stg
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Docker Compose
run: |
python3 -m pip install docker-compose
- name: Install AWS CLI
run: |
python3 -m pip install awscli
.
- name: Configure AWS Region
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-1
- 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: Login to AWS ECR
id: login_ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, Tag, and Push Image to AWS ECR
env:
IMAGE_TAG: latest
ENV: ${{ steps.extract_environment.outputs.result }}
run: |
export ENV=$ENV
docker-compose build
docker-compose push