@@ -15,21 +15,43 @@ jobs:
15
15
steps :
16
16
- name : Checkout code
17
17
uses : actions/checkout@v4
18
- - name : Set up JDK 21
19
- uses : actions/setup-java@v3
18
+ - uses : actions/checkout@v4
19
+ - name : Check the cache
20
+ uses : actions/cache/restore@v3
21
+ id : cache
20
22
with :
21
- java-version : " 21"
22
- distribution : " corretto"
23
- - name : Clean install
24
- run : ./mvnw --no-transfer-progress clean install -DskipTests -Ddependency-check.skip -Dcyclonedx.skip=true -Dexec.skip
25
- - name : Cache JAR file
26
- id : cache-jar
27
- uses : actions/cache@v3
28
- with :
29
- path : ./target/wrongsecrets-1.7.0-SNAPSHOT.jar
23
+ path : ./target
30
24
key : JarCache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
31
- restore-keys : |
32
- JarCache-${{ runner.os }}-
25
+ restore-keys : jar-
26
+ - name : Check cache hit
27
+ id : cache-hit-check
28
+ run : echo "cache-hit=${{ steps.cache.outputs.cache-hit }}" >> $GITHUB_ENV
29
+ # - name: Set up JDK 21
30
+ # uses: actions/setup-java@v3
31
+ # with:
32
+ # java-version: "21"
33
+ # distribution: "corretto"
34
+ # - name: Clean install
35
+ # run: ./mvnw --no-transfer-progress clean install -DskipTests -Ddependency-check.skip -Dcyclonedx.skip=true -Dexec.skip
36
+ # - name: Cache JAR file
37
+ # id: cache-jar
38
+ # uses: actions/cache@v3
39
+ # with:
40
+ # path: ./target/wrongsecrets-1.7.0-SNAPSHOT.jar
41
+ # key: JarCache-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
42
+ # restore-keys: |
43
+ # JarCache-${{ runner.os }}-
44
+ - name : Trigger JAR cache build
45
+ if : steps.cache.outputs.cache-hit != 'true'
46
+ uses : actions/github-script@v6
47
+ with :
48
+ script : |
49
+ await github.rest.actions.createWorkflowDispatch({
50
+ owner: context.repo.owner,
51
+ repo: context.repo.repo,
52
+ workflow_id: 'building-jar-cache.yml', # workflow filename
53
+ ref: 'main'
54
+ })
33
55
- name : Start wrongsecrets
34
56
run : nohup ./mvnw spring-boot:run -Dspring-boot.run.profiles=without-vault &
35
57
- name : ZAP Scan
0 commit comments