File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed
Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Cache Maven Dependencies"
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ - cron : ' 57 4 * * Sun'
7+
8+ env :
9+ MAVEN_CACHE_REF : refs/heads/main
10+ MAVEN_CACHE_KEY : maven-dependencies
11+ MAVEN_CACHE_DIR : ~/.m2
12+
13+ jobs :
14+ update-cache :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : " Checkout"
18+ uses : actions/checkout@v5
19+ with :
20+ ref : ${{ env.MAVEN_CACHE_REF }}
21+
22+ - name : " Setup Java"
23+ uses : actions/setup-java@v5
24+ with :
25+ distribution : " sapmachine"
26+ java-version : 17
27+
28+ - name : " Download Dependencies"
29+ run : mvn -B dependency:go-offline
30+
31+ - name : " Delete Existing Caches"
32+ run : |
33+ CACHE_IDS=$(gh cache list --key "${{ env.MAVEN_CACHE_KEY }}" --ref "${{ env.MAVEN_CACHE_REF }}" --json id | jq -r '.[] | .id')
34+ for CACHE_ID in $CACHE_IDS; do
35+ echo "Deleting cache with ID: $CACHE_ID"
36+ gh cache delete "${CACHE_ID}"
37+ done
38+ env :
39+ GH_TOKEN : ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
40+
41+ - name : " Cache Dependencies"
42+ uses : actions/cache/save@v4
43+ with :
44+ path : ${{ env.MAVEN_CACHE_DIR }}
45+ key : ${{ env.MAVEN_CACHE_KEY }}
Original file line number Diff line number Diff line change 1010 MVN_MULTI_THREADED_ARGS : --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
1111 MVN_SKIP_CI_PLUGINS : -DskipFormatting -Denforcer.skip -Djacoco.skip -Dmdep.analyze.skip
1212 JAVA_VERSION : 17
13+ # keep the following two variables in sync with our 'cache-maven-dependencies.yaml' workflow
14+ MAVEN_CACHE_KEY : maven-dependencies
15+ MAVEN_CACHE_DIR : ~/.m2
1316
1417jobs :
1518
3336 java-version : ${{ env.JAVA_VERSION }}
3437 cache : ' maven'
3538
39+ - name : " Restore Dependencies"
40+ id : restore-dependencies
41+ uses : actions/cache/restore@v4
42+ with :
43+ key : ${{ env.MAVEN_CACHE_KEY }}
44+ path : ${{ env.MAVEN_CACHE_DIR }}
45+
3646 - name : " REUSE Compliance Check"
3747 uses : fsfe/reuse-action@v5
3848
Original file line number Diff line number Diff line change 2727env :
2828 MVN_MULTI_THREADED_ARGS : --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
2929 JAVA_VERSION : 17
30+ # keep the following two variables in sync with our 'cache-maven-dependencies.yaml' workflow
31+ MAVEN_CACHE_KEY : maven-dependencies
32+ MAVEN_CACHE_DIR : ~/.m2
3033
3134jobs :
3235 generate :
5962 java-version : ${{ env.JAVA_VERSION }}
6063 cache : ' maven'
6164
65+ - name : " Restore Dependencies"
66+ id : restore-dependencies
67+ uses : actions/cache/restore@v4
68+ with :
69+ key : ${{ env.MAVEN_CACHE_KEY }}
70+ path : ${{ env.MAVEN_CACHE_DIR }}
71+
6272 - name : " Checkout or Create Branch"
6373 id : branch
6474 # Checkout branch if it exists, otherwise create it
You can’t perform that action at this time.
0 commit comments