15
15
name : Build with unit tests
16
16
17
17
on :
18
- workflow_run :
19
- workflows :
20
- - Trigger build
21
- types :
22
- - completed
18
+ push :
19
+ branches : [ develop, release/** ]
20
+ pull_request :
21
+ branches : [ develop, release/** ]
22
+ types : [opened, synchronize, reopened, labeled]
23
23
24
24
jobs :
25
25
build :
26
26
runs-on : k8s-runner-build
27
27
28
- if : ${{ github.event.workflow_run.conclusion != 'skipped' }}
29
-
28
+ # We allow builds:
29
+ # 1) When it's a merge into a branch
30
+ # 2) For PRs that are labeled as build and
31
+ # - It's a code change
32
+ # - A build label was just added
33
+ # A bit complex, but prevents builds when other labels are manipulated
34
+ if : >
35
+ github.event_name == 'push'
36
+ || (contains(github.event.pull_request.labels.*.name, 'build')
37
+ && (github.event.action != 'labeled' || github.event.label.name == 'build')
38
+ )
30
39
steps :
31
- # Pinned 1.0.0 version
32
- - uses : haya14busa/action-workflow_run-status@967ed83efa565c257675ed70cfe5231f062ddd94
33
-
40
+ - uses : actions/checkout@v3
34
41
with :
35
42
ref : ${{ github.event.workflow_run.head_sha }}
36
43
- name : Cache
@@ -43,18 +50,11 @@ jobs:
43
50
- name : Build with Maven
44
51
run : mvn clean test -fae -T 2 -B -V -DcloudBuild -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25
45
52
- name : Archive build artifacts
46
- uses : actions/upload-artifact@v2.2.2
53
+ uses : actions/upload-artifact@v4
47
54
if : always()
48
55
with :
49
- name : Build debug files
56
+ name : reports-${{ github.run_id }}
50
57
path : |
51
58
**/target/rat.txt
52
59
**/target/surefire-reports/*
53
- - name : Surefire Report
54
- # Pinned 1.0.5 version
55
- uses : ScaCap/action-surefire-report@ad808943e6bfbd2e6acba7c53fdb5c89534da533
56
- if : always()
57
- with :
58
- # GITHUB_TOKEN
59
- github_token : ${{ secrets.GITHUB_TOKEN }}
60
- commit : ${{ github.event.workflow_run.head_sha }}
60
+
0 commit comments