mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-11 13:49:08 +00:00
59 lines
1.3 KiB
YAML
59 lines
1.3 KiB
YAML
name: Deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- stg
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Update Pip
|
|
run: |
|
|
python3 -m pip install --upgrade pip
|
|
|
|
- name: Install Docker Compose
|
|
run: |
|
|
python3 -m pip install docker-compose --upgrade
|
|
|
|
- name: Install AWS CLI
|
|
run: |
|
|
python3 -m pip install awscli --upgrade
|
|
|
|
- name: Install AWS Elastic Beanstalk ClI
|
|
run: |
|
|
python3 -m pip install awsebcli --upgrade
|
|
|
|
- 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:
|
|
ENV: ${{ steps.extract_environment.outputs.result }}
|
|
IMAGE_TAG: latest
|
|
run: |
|
|
export ENV=$ENV
|
|
docker-compose build
|
|
docker-compose push
|