Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inputs.cache-save-always #34

Merged
merged 9 commits into from
Jan 23, 2024
11 changes: 5 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ inputs:
cache-prefix:
required: true
default: ""
cache-save-always:
description: "Save the dependencies and build cache even if a build fails"
default: false
outputs:
compiler:
description: "compiler.actual value from stack query"
Expand Down Expand Up @@ -194,7 +197,6 @@ runs:
done

- name: Restore dependencies cache
id: restore-deps
uses: actions/cache/restore@v3
with:
path: |
Expand All @@ -207,7 +209,6 @@ runs:
${{ inputs.cache-prefix }}${{ runner.os }}-stack-deps-${{ steps.stack-query.outputs.compiler }}-

- name: Dependencies
if: steps.restore-deps.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
Expand All @@ -220,7 +221,7 @@ runs:
${{ inputs.stack-arguments }}

- name: Save dependencies cache
if: steps.restore-deps.outputs.cache-hit != 'true'
if: success() || (failure() && inputs.cache-save-always)
stackptr marked this conversation as resolved.
Show resolved Hide resolved
stackptr marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/cache/save@v3
with:
path: |
Expand All @@ -230,7 +231,6 @@ runs:
key: ${{ inputs.cache-prefix }}${{ runner.os }}-stack-deps-${{ steps.stack-query.outputs.compiler }}-${{ steps.setup.outputs.snapshot-hash }}-${{ steps.setup.outputs.package-hash }}

- name: Restore build cache
id: restore-build
uses: actions/cache/restore@v3
with:
path: ${{ steps.setup.outputs.stack-works }}
Expand All @@ -240,7 +240,6 @@ runs:
${{ inputs.cache-prefix }}${{ runner.os }}-stack-build-${{ steps.setup.outputs.snapshot-hash }}-

- name: Build
if: steps.restore-build.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
Expand All @@ -251,7 +250,7 @@ runs:
${{ inputs.stack-arguments }}

- name: Save build cache
if: steps.restore-build.outputs.cache-hit != 'true'
if: success() || (failure() && inputs.cache-save-always)
uses: actions/cache/save@v3
with:
path: ${{ steps.setup.outputs.stack-works }}
Expand Down