checking merged pull request

This commit is contained in:
work 2025-03-18 22:49:38 +01:00
parent 3900f08bad
commit 29a99d4c9c
2 changed files with 56 additions and 5 deletions

51
.github/workflows/check.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: CI/CD pipeline for successful merge
on:
workflow_dispatch:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: '21'
cache: 'maven'
distribution: 'corretto'
- name: Maven install dependencies
run: ./mvnw clean install -Dmaven.test.skip=true
docker:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build
uses: docker/build-push-action@v6
with:
push: false
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/apiprotector:$${{ github.sha }}
- name: Docker Push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/apiprotector:$${{ github.sha }}

10
pom.xml
View file

@ -165,6 +165,11 @@
<artifactId>spring-boot-docker-compose</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
@ -329,11 +334,6 @@
</plugin>
<!-- Spring Boot Actuator displays sbom-related information if a CycloneDX SBOM file is
present at the classpath -->
<plugin>
<?m2e ignore?>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
</plugin>
</plugins>
</build>