forked from SAP/ai-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.2 KB
/
cache-maven-dependencies.yaml
File metadata and controls
47 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: "Cache Maven Dependencies"
permissions:
contents: read
on:
workflow_dispatch:
schedule:
- cron: '57 4 * * Sun'
env:
MAVEN_CACHE_REF: refs/heads/main
MAVEN_CACHE_KEY: maven-dependencies
MAVEN_CACHE_DIR: ~/.m2
jobs:
update-cache:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v6
with:
ref: ${{ env.MAVEN_CACHE_REF }}
- name: "Setup Java"
uses: actions/setup-java@v5
with:
distribution: "sapmachine"
java-version: 21
- name: "Download Dependencies"
run: mvn -B dependency:go-offline
- name: "Delete Existing Caches"
run: |
CACHE_IDS=$(gh cache list --key "${{ env.MAVEN_CACHE_KEY }}" --ref "${{ env.MAVEN_CACHE_REF }}" --json id | jq -r '.[] | .id')
for CACHE_ID in $CACHE_IDS; do
echo "Deleting cache with ID: $CACHE_ID"
gh cache delete "${CACHE_ID}"
done
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
- name: "Cache Dependencies"
uses: actions/cache/save@v5
with:
path: ${{ env.MAVEN_CACHE_DIR }}
key: ${{ env.MAVEN_CACHE_KEY }}