diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..b84396e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/target/classes/dbp/hackathon/Estudiante/EstudianteController.class b/target/classes/dbp/hackathon/Estudiante/EstudianteController.class index 9f77ad3..a315727 100644 Binary files a/target/classes/dbp/hackathon/Estudiante/EstudianteController.class and b/target/classes/dbp/hackathon/Estudiante/EstudianteController.class differ diff --git a/target/hackathon-0.0.1-SNAPSHOT.jar b/target/hackathon-0.0.1-SNAPSHOT.jar index 55afb03..f7cd34d 100644 Binary files a/target/hackathon-0.0.1-SNAPSHOT.jar and b/target/hackathon-0.0.1-SNAPSHOT.jar differ diff --git a/target/hackathon-0.0.1-SNAPSHOT.jar.original b/target/hackathon-0.0.1-SNAPSHOT.jar.original index d97248a..e6caf90 100644 Binary files a/target/hackathon-0.0.1-SNAPSHOT.jar.original and b/target/hackathon-0.0.1-SNAPSHOT.jar.original differ