Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
José Sandro Rogério Mendes de Araújo committed Feb 24, 2024
2 parents a50507d + 1a9b3d1 commit f8a60f2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ permissions:
jobs:
deploy:
name: Deploy on AWS
runs-on: self-hosted
runs-on: ubuntu-latest
environment: production

steps:
Expand All @@ -56,8 +56,11 @@ jobs:
with:
java-version: 11
- name: Build with Maven
run: mvn -B package --file pom.xml

run: |
cd app/
mvn -B package --file pom.xml
cd ..
- name: Checkout
uses: actions/checkout@v3

Expand All @@ -70,24 +73,23 @@ jobs:

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

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: $ECR_REPOSITORY
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
working-directory: ./app
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
cd app/
mvn build package
cd ..
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg ACCESS_ARG=${{ secrets.AWS_ACCESS_KEY_ID }} --build-arg SECRET_ARG=${{ secrets.AWS_SECRET_ACCESS_KEY }} .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
cd ..
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
Expand Down

0 comments on commit f8a60f2

Please sign in to comment.