Skip to content

Commit 80d7865

Browse files
authored
Merge GitHub workflow (#115)
* Merge GitHub workflow * Deploy on main only
1 parent b26327f commit 80d7865

File tree

2 files changed

+14
-71
lines changed

2 files changed

+14
-71
lines changed

.github/workflows/push_main.yml renamed to .github/workflows/build.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
name: Push Main
1+
name: Build
22

33
on:
44
push:
55
branches:
66
- 'main'
7+
pull_request:
8+
branches:
9+
- 'main'
710

811
jobs:
912
build:
@@ -15,6 +18,13 @@ jobs:
1518
with:
1619
fetch-depth: 0
1720

21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21'
25+
distribution: 'temurin'
26+
cache: maven
27+
1828
- name: Cache SonarQube packages
1929
uses: actions/cache@v4
2030
with:
@@ -29,21 +39,11 @@ jobs:
2939
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3040
restore-keys: ${{ runner.os }}-m2
3141

32-
- name: Set up JDK 21
33-
uses: actions/setup-java@v4
34-
with:
35-
java-version: '21'
36-
distribution: 'temurin'
37-
cache: maven
38-
3942
- name: Lint
4043
run: mvn spotless:check
4144

4245
- name: Build
43-
run: mvn -B compile
44-
45-
- name: Test
46-
run: mvn -B test
46+
run: mvn clean package
4747

4848
- name: Publish test report
4949
if: always()
@@ -52,12 +52,14 @@ jobs:
5252
report_paths: '**/target/surefire-reports/TEST-*.xml'
5353

5454
- name: Sonar
55+
if: github.event.pull_request.head.repo.fork == false
5556
run: mvn verify sonar:sonar
5657
env:
5758
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5859
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5960

6061
- name: Docker
62+
if: github.ref == 'refs/heads/main'
6163
run: mvn -B -DskipTests package jib:build -Djib.to.auth.username=$DOCKER_USER -Djib.to.auth.password=$DOCKER_TOKEN
6264
env:
6365
DOCKER_USER: ${{ secrets.DOCKER_USER }}

.github/workflows/pull_request.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)