Skip to content

Commit

Permalink
feat: deploy production action
Browse files Browse the repository at this point in the history
  • Loading branch information
Matheusafonsouza committed Oct 29, 2022
1 parent 6e86615 commit af51a90
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/deploy-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to ECR

on:
push:
tags:
- v*

jobs:
gen-tag:
name: Get tag
runs-on: ubuntu-latest

steps:
- name: Set env
id: tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
outputs:
tag: ${{ steps.tag.outputs.tag }}

build:
name: Build Image
runs-on: ubuntu-latest

steps:
- name: Check out code
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: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: docker-beanstalk-production
IMAGE_TAG: ${{ needs.gen-tag.outputs.tag }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./application
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

0 comments on commit af51a90

Please sign in to comment.