Skip to content

Commit a3bf46c

Browse files
committed
ci always save cache
1 parent 0d3da6c commit a3bf46c

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

.github/actions/universal-package/action.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ runs:
5353
5454
echo '::endgroup::'
5555
56-
- name: Cache keg
57-
id: cache-keg
58-
uses: actions/cache@v4
56+
- name: Restore keg cache
57+
id: cache-keg-restore
58+
uses: actions/cache/restore@v4
5959
with:
6060
path: ${{ steps.setup-formula.outputs.brew_prefix }}/Cellar/${{ inputs.formula }}
6161
key: ${{ inputs.formula }}-homebrew-cache-custom-unified-prefix${{ steps.setup-formula.outputs.brew_prefix }}-xcode${{ steps.setup-formula.outputs.xcode_version }}-${{ hashFiles(format('{0}.rb', inputs.formula)) }}
6262

6363
- name: Install formula
64+
id: install-formula
6465
shell: bash
6566
run: |
6667
echo '::group::Install formula'
@@ -93,3 +94,16 @@ runs:
9394
done
9495
9596
echo '::endgroup::'
97+
98+
- name: Save keg cache
99+
id: cache-keg-save
100+
uses: actions/cache/save@v4
101+
# We always save the generated artifact even if the whole run
102+
# fails due to other issues. This helps debugging build
103+
# failure issues faster if the cache doesn't already exist as
104+
# we want subsequent runs to not have to re-generate this
105+
# artifact again.
106+
if: always() && steps.cache-keg-restore.outputs.cache-hit != 'true' && steps.install-formula.conclusion == 'success'
107+
with:
108+
path: ${{ steps.setup-formula.outputs.brew_prefix }}/Cellar/${{ inputs.formula }}
109+
key: ${{ steps.cache-keg-restore.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)