Compare commits

..

5 Commits

Author SHA1 Message Date
Vipul
0769f2e443 Merge branch 'main' into master 2022-11-28 23:50:15 -08:00
Vipul
515d10b4fd Merge pull request #746 from actions/revert-173-add-stack-example
Revert "Add example for Haskell Stack"
2022-02-22 12:44:25 +05:30
Vipul
669e7536d9 Revert "Add example for Haskell Stack" 2022-02-22 12:17:37 +05:30
Vipul
29dbbce762 Merge pull request #173 from malob/add-stack-example
Add example for Haskell Stack
2022-02-22 12:11:06 +05:30
Malo Bourgon
ea5981db97 Add example for Haskell Stack 2022-02-21 14:59:28 -08:00

View File

@@ -309,44 +309,14 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
For npm, cache files are stored in `~/.npm` on Posix, or `~\AppData\npm-cache` on Windows, but it's possible to use `npm config get cache` to find the path on any platform. See [the npm docs](https://docs.npmjs.com/cli/cache#cache) for more details.
If using `npm config` to retrieve the cache directory, ensure you run [actions/setup-node](https://github.com/actions/setup-node) first to ensure your `npm` version is correct.
After [deprecation](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/) of save-state and set-output commands, the correct way to set output is using `${GITHUB_OUTPUT}`. For linux, we can use `${GITHUB_OUTPUT}` whereas for windows we need to use `${env:GITHUB_OUTPUT}` due to two different default shells in these two different OS ie `bash` and `pwsh` respectively.
>Note: It is not recommended to cache `node_modules`, as it can break across Node versions and won't work with `npm ci`
### **Get npm cache directory using default shells**
### Linux or Mac
```yaml
- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
```
### Windows
```yaml
- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT}
```
### **Get npm cache directory using same shell**
### Bash shell
```yaml
- name: Get npm cache directory
id: npm-cache
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
```
### PWSH shell
```yaml
- name: Get npm cache directory
id: npm-cache
shell: pwsh
run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT}
```
`Get npm cache directory` step can then be used with `actions/cache` as shown below
```yaml
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with: