Merge pull request #2 from netty/cache-key

Include year and week number in build cache key
This commit is contained in:
Chris Vest 2020-11-23 12:00:43 +01:00 committed by GitHub
commit 6e23ba139d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,8 @@ on:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main ]
schedule:
- cron: '30 6 * * 1' # At 06:30 on Monday, every Monday.
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
@ -20,12 +22,23 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# http://man7.org/linux/man-pages/man1/date.1.html
- name: Create Cache Key
id: cache-key
run: |
echo "::set-output name=key::$(/bin/date -u "+%Y%U")"
shell: bash
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Enable caching of Docker layers # Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.8 - uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true continue-on-error: true
with:
key: docker-cache-${{ steps.cache-key.outputs.key }}-{hash}
restore-keys: |
docker-cache-${{ steps.cache-key.outputs.key }}-
# Run the make script # Run the make script
- name: Make build - name: Make build