Skip to content

Commit 7af95e2

Browse files
committed
Convert to composite action over stack-action
This is an minor improvement over archiving as-is with documentation pushing users to `stack-action`. As a `composite`, this action should require little-to-no maintenance; only if/when `stack-action` has a major version bump. The known downsides to this approach are: 1. We lost the `cache-hit` output 2. Building with `--dry-run` does do some more work than before 3. The `setup` step installs GHC if necessary Of these, only (3) is a minor concern since it does add a bit of time. However: * It only happens on un-cached runs, and * If we assume users of this action will in fact build something somewhere, we are not _adding_ this time, only moving it Therefore, we consider this acceptable.
1 parent 0d89610 commit 7af95e2

28 files changed

Lines changed: 56 additions & 3438 deletions

.github/workflows/ci.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/example.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
working-directory: example
2121
- name: Build
2222
run: |
23-
echo "cache-hit: ${{steps.stack-cache.outputs.cache-hit}}"
2423
find .
2524
mkdir -p ~/.stack ./.stack-work ./package/.stack-work
2625
echo "An artifact" > ~/.stack/artifact

.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,28 @@
22

33
Cache step for Stack-based Haskell projects on GitHub Actions.
44

5-
**NOTE**: if you are using `freckle/stack-action@v4` or newer, you do not
6-
need this action as its own step. That version of that action handles all
7-
caching internally, and better.
5+
> [!NOTE]
6+
>
7+
> As of `@v3`, this action is a `composite` pass-through to `stack-action`:
8+
>
9+
> ```yaml
10+
> - uses: freckle/stack-action@v6
11+
> env:
12+
> STACK_YAML: ${{ inputs.stack-yaml }}
13+
> with:
14+
> working-directory: ${{ inputs.working-directory }}
15+
> cache-prefix: ${{ inputs.prefix }}
16+
> stack-build-arguments: --dry-run
17+
> install-stack: false
18+
> upgrade-stack: false
19+
> ```
20+
>
21+
> You could consider replacing use of this action with that directly.
822
923
## Usage
1024
1125
```yml
12-
uses: freckle/stack-cache-action@v2
26+
uses: freckle/stack-cache-action@v3
1327
```
1428
1529
## Behavior
@@ -29,10 +43,6 @@ uses: freckle/stack-cache-action@v2
2943
- `working-directory`: Useful in monorepositories
3044
- `prefix`: A prefix to include on keys; useful for cache busting or versioning
3145
32-
## Outputs
33-
34-
- `cache-hit`: indicates a full cache hit on the primary key
35-
3646
## Further Reading
3747
3848
See https://tech.freckle.com/2021/05/18/haskell-on-actions/ for a short tutorial.

action.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: "Stack cache"
22
author: "freckle"
33
description: "Caching Action for Stack-based Haskell projects"
4-
runs:
5-
using: "node16"
6-
main: "dist/restore/index.js"
7-
post: "dist/save/index.js"
84
inputs:
95
stack-yaml:
106
description: "Path to stack.yaml"
@@ -18,6 +14,17 @@ inputs:
1814
description: "A prefix to include on keys; useful for cache busting or versioning"
1915
required: false
2016
default: ""
21-
outputs:
22-
cache-hit:
23-
description: "A boolean value to indicate an exact match was found for the primary key"
17+
runs:
18+
using: "composite"
19+
steps:
20+
- uses: freckle/stack-action@v5
21+
env:
22+
STACK_YAML: ${{ inputs.stack-yaml }}
23+
with:
24+
working-directory: ${{ inputs.working-directory }}
25+
cache-prefix: ${{ inputs.cache-prefix }}
26+
27+
# Avoid other stack-action behavior, as much as we can
28+
stack-build-arguments: --dry-run
29+
install-stack: false
30+
upgrade-stack: false

dist/restore/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)