File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,12 +88,19 @@ runs:
8888 key : xml-model-validator-runtime-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
8989 restore-keys : |
9090 xml-model-validator-runtime-${{ runner.os }}-
91+ - name : Restore Validator JAR Cache
92+ id : restore-jar-cache
93+ uses : actions/cache/restore@v5
94+ with :
95+ path : ~/.cache/xml-model-validator/jar
96+ key : xml-model-validator-jar-${{ runner.os }}-${{ github.action_sha }}
9197 - name : Set Up Java
9298 uses : actions/setup-java@v5
9399 with :
94100 distribution : temurin
95101 java-version : " 25"
96102 - name : Set Up Gradle
103+ if : steps.restore-jar-cache.outputs.cache-hit != 'true'
97104 uses : gradle/actions/setup-gradle@v6
98105 - name : Validate XML
99106 id : validate
@@ -121,6 +128,12 @@ runs:
121128 run : |
122129 set -euo pipefail
123130 bash "${{ github.action_path }}/entrypoint.sh"
131+ - name : Save Validator JAR Cache
132+ if : always() && steps.restore-jar-cache.outputs.cache-hit != 'true'
133+ uses : actions/cache/save@v5
134+ with :
135+ path : ~/.cache/xml-model-validator/jar
136+ key : xml-model-validator-jar-${{ runner.os }}-${{ github.action_sha }}
124137 - name : Save Validator Runtime Cache
125138 if : always() && steps.restore-runtime-cache.outputs.cache-hit != 'true'
126139 uses : actions/cache/save@v5
Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ build_validator_jar() {
2323 cp " ${ACTION_ROOT} /build/libs/xml-model-validator.jar" " ${JAR_PATH} "
2424}
2525
26+ download_validator_jar () {
27+ if [ -z " ${GITHUB_ACTION_REF:- } " ] || [ -z " ${GITHUB_ACTION_REPOSITORY:- } " ]; then
28+ return 1
29+ fi
30+ gh release download " ${GITHUB_ACTION_REF} " \
31+ --repo " ${GITHUB_ACTION_REPOSITORY} " \
32+ --pattern " xml-model-validator.jar" \
33+ --dir " ${JAR_CACHE_DIR} " \
34+ --clobber 2> /dev/null
35+ }
36+
2637ensure_git_history () {
2738 if [ " $( git rev-parse --is-shallow-repository 2> /dev/null || printf ' false' ) " = " true" ]; then
2839 git fetch --no-tags --prune --unshallow origin > /dev/null 2>&1 || true
@@ -420,7 +431,11 @@ else
420431fi
421432
422433if [ ! -f " ${JAR_PATH} " ]; then
423- build_validator_jar
434+ if download_validator_jar; then
435+ echo " XML Model Validator: downloaded pre-built JAR for ${GITHUB_ACTION_REF:- unknown} ." >&2
436+ else
437+ build_validator_jar
438+ fi
424439fi
425440
426441set +e
You can’t perform that action at this time.
0 commit comments