Skip to content

Commit 39d4fc6

Browse files
committed
ci: fix cache key
1 parent ce6713c commit 39d4fc6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/stack-build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,22 @@ jobs:
5151
stack-no-global: true
5252

5353
- name: Configure the build
54+
id: configure
5455
run: |
55-
echo "with key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}"
56+
echo "with key: ${{ runner.os }}-lts-${{ matrix.stack.lts }}"
5657
5758
stack config set resolver lts-${{ matrix.stack.lts }}
5859
stack build --dry-run
5960
# The last step generates dist-newstyle/cache/plan.json for the cache key.
6061
62+
outputs:
63+
cache-key: ${{ runner.os }}-lts-${{ matrix.stack.lts }}
64+
6165
- name: Restore cached dependencies
6266
uses: actions/cache/restore@v3
6367
id: cache
6468
env:
65-
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
69+
key: ${{ steps.configure.outputs.cache-key }}
6670

6771
with:
6872
path: ${{ steps.setup.outputs.stack-root }}
@@ -72,7 +76,8 @@ jobs:
7276
- name: Install dependencies
7377
run: stack build --only-dependencies
7478

75-
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
79+
# Cache dependencies already here, so that we do not have to rebuild them
80+
# should the subsequent steps fail.
7681
- name: Save cached dependencies
7782
uses: actions/cache/save@v3
7883
# Caches are immutable, trying to save with the same key would error.

0 commit comments

Comments
 (0)