adding workflow for mr

This commit is contained in:
work 2025-02-12 18:18:05 +01:00
parent 2ad64f97c7
commit c2762418ab
2 changed files with 53 additions and 16 deletions

36
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: Maven github actions CI/CD for merge
on:
workflow_dispatch:
pull_request:
branches:
- main
types: [closed]
jobs:
my-action:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: my-ecr-repo
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG

33
pom.xml
View file

@ -5,22 +5,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0</version>
<version>3.2.0</version>
<relativePath />
</parent>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://localhost:8081/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
<scm>
<connection>scm:git:git@github.com:Piasecki-grid/maven-project.git</connection>
<developerConnection>scm:git:git@github.com:Piasecki-grid/maven-project.git</developerConnection>
@ -57,7 +47,22 @@
<spring-format.version>0.0.43</spring-format.version>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<dependencies>
<!-- Spring and Spring Boot dependencies -->
<dependency>
@ -340,10 +345,6 @@
</licenses>
<repositories>
<repository>
<id>maven-group</id>
<url>http://localhost:8081/repository/maven-central/</url>
</repository>
<repository>
<snapshots>