Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted maven-periodic-cache-action
For when dependencies change frequently.
- Loading branch information
Showing
4 changed files
with
33 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Maven Periodic Cache | ||
description: Caches the Maven repository periodically by date. | ||
inputs: | ||
cache-period-days: | ||
description: The maximum duration in days to keep the cache. | ||
required: true | ||
default: '30' | ||
additional-paths: | ||
description: Additional paths to cache (or not cache). | ||
required: false | ||
default: '' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Calculate the cache period | ||
shell: bash | ||
run: | | ||
leveler="$(wc -c <<< "$GITHUB_REPOSITORY")" | ||
echo "::set-output name=CACHE_PERIOD::$(date +%Y)-$(($(($leveler + $(date +%-j))) / ${{ inputs.cache-period-days }}))" | ||
id: cache-interval | ||
- name: Cache the local Maven repository | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
${{ inputs.additional-paths }} | ||
key: ${{ runner.os }}-maven-${{ steps.cache-interval.outputs.CACHE_PERIOD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters