Compare commits
2 commits
main
...
maven-cach
Author | SHA1 | Date | |
---|---|---|---|
9da1fd106c | |||
571dbb4b6f |
1 changed files with 38 additions and 1 deletions
|
@ -31,12 +31,49 @@ jobs:
|
|||
}
|
||||
}]
|
||||
|
||||
- name: Generate Maven Repository cache keys
|
||||
id: cache-key
|
||||
run: |
|
||||
CURRENT_BRANCH="${{ gitea.base_ref || gitea.ref_name }}"
|
||||
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
|
||||
CURRENT_DAY=$(/bin/date -u "+%d")
|
||||
ROOT_CACHE_KEY="m2-cache"
|
||||
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITEA_OUTPUT
|
||||
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITEA_OUTPUT
|
||||
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITEA_OUTPUT
|
||||
|
||||
- name: Cache Maven Repository
|
||||
id: cache-maven
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
|
||||
# The whole cache is dropped monthly to prevent unlimited growth.
|
||||
# The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
|
||||
key: ${{ steps.cache-key.outputs.m2-cache-key }}
|
||||
restore-keys: |
|
||||
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
|
||||
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
|
||||
|
||||
- name: Restore Maven Repository
|
||||
uses: https://github.com/actions/cache/restore@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ steps.cache-key.outputs.m2-cache-key }}
|
||||
restore-keys: |
|
||||
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
|
||||
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
|
||||
|
||||
- name: Make maven wrapper executable
|
||||
run: chmod +x mvnw
|
||||
|
||||
- name: Populate the cache
|
||||
run: |
|
||||
./mvnw quarkus:go-offline
|
||||
|
||||
- name: Build and run tests
|
||||
run: ./mvnw verify
|
||||
|
||||
- name: Upload libs to Gitea Maven Registry
|
||||
- name: Upload libs to Forgejo Maven Registry
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
run: ./mvnw deploy -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
|
Loading…
Add table
Add a link
Reference in a new issue