Skip to content

Commit

Permalink
fix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi committed Jan 30, 2025
1 parent 69c9344 commit 4fb654e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/actions/asdf-install-tooling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This action will:
| `os` | <p>Target OS (linux or darwin)</p> | `false` | `linux` |
| `arch` | <p>Target architecture (amd64, arm64, etc.)</p> | `false` | `amd64` |
| `asdf_path_tools` | <p>Path where asdf installs tools</p> | `false` | `/home/runner/.asdf` |
| `cache` | <p>Use cache for tools installed</p> | `false` | `true` |


## Runs
Expand Down Expand Up @@ -54,4 +55,10 @@ This action is a `composite` action.
#
# Required: false
# Default: /home/runner/.asdf

cache:
# Use cache for tools installed
#
# Required: false
# Default: true
```
14 changes: 9 additions & 5 deletions .github/actions/asdf-install-tooling/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
asdf_path_tools:
description: Path where asdf installs tools
default: /home/runner/.asdf
cache:
description: Use cache for tools installed
default: 'true'

runs:
using: composite
Expand All @@ -39,17 +42,18 @@ runs:
- name: Check if asdf cache exists
id: cache-asdf-check
if: ${{ inputs.cache == 'true' }}
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
${{ inputs.asdf_path_tools }}
# invalidate the cache every week as we might need dependencies of the packages
# invalidate the cache every week as we might need dependencies of the packages
key: ${{ steps.cache-key.outputs.cache_key }}

- name: Install asdf when no cache hit
id: install
shell: bash
if: ${{ steps.cache-key.outputs.cache-hit == 'false' }}
if: ${{ inputs.cache == 'false' || steps.cache-asdf-check.outputs.cache-hit == 'false' }}
run: |
set -euxo pipefail
Expand Down Expand Up @@ -79,7 +83,7 @@ runs:
- name: Install asdf plugins and tools from .tool-versions
id: tools-plugins-install
if: ${{ steps.cache-key.outputs.cache-hit == 'false' }}
if: ${{ inputs.cache == 'false' || steps.cache-asdf-check.outputs.cache-hit == 'false' }}
shell: bash
run: |
asdf current
Expand All @@ -94,10 +98,10 @@ runs:
- name: Cache installed tools
id: cache-tools
if: ${{ steps.cache-key.outputs.cache-hit == 'false' }}
if: ${{ inputs.cache == 'false' || steps.cache-asdf-check.outputs.cache-hit == 'false' }}
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
${{ inputs.asdf_path_tools }}
# invalidate the cache every week as we might need dependencies of the packages
# invalidate the cache every week as we might need dependencies of the packages
key: ${{ steps.cache-key.outputs.cache_key }}

0 comments on commit 4fb654e

Please sign in to comment.