Skip to content

Commit

Permalink
avances
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielromerod committed May 16, 2024
1 parent 8724880 commit 1eaa7f7
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Java CI with Maven

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Build and test with Maven
run: mvn -B clean package --file pom.xml

- name: Build Docker image
run: |
docker build -t spring-boot-app
- name: Tag Docker image
env:
USER_ID: ${{ secrets.USER_ID }}
ECR_REPOSITORY_NAME: ${{ secrets.ECR_REPOSITORY_NAME }}
run: |
docker tag spring-boot-app ${{ secrets.USER_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_NAME }}:latest
- 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: Log in to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1

- name: Push Docker image to ECR
env:
USER_ID: ${{ secrets.USER_ID }}
ECR_REPOSITORY_NAME: ${{ secrets.ECR_REPOSITORY_NAME }}
run: |
docker push ${{ secrets.USER_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_NAME }}:latest
- name: Update ECS service
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
CLUSTER_NAME: ${{ secrets.CLUSTER_NAME }}
SERVICE_NAME: ${{ secrets.SERVICE_NAME }}
run: |
aws ecs update-service \
--cluster $CLUSTER_NAME \
--service $SERVICE_NAME \
--force-new-deployment \
--region $AWS_REGION
Binary file modified target/classes/dbp/hackathon/Estudiante/EstudianteController.class
Binary file not shown.
Binary file modified target/hackathon-0.0.1-SNAPSHOT.jar
Binary file not shown.
Binary file modified target/hackathon-0.0.1-SNAPSHOT.jar.original
Binary file not shown.

0 comments on commit 1eaa7f7

Please sign in to comment.