mirror of
https://github.com/actions/cache.git
synced 2024-11-26 16:36:14 +08:00
Revert original C# Example
* Treat "Use Personal Cache Folder" way as another C# example * Describe the situation in which another example should be used
This commit is contained in:
parent
002d3a77f4
commit
0188dffc5a
14
examples.md
14
examples.md
@ -17,10 +17,20 @@
|
|||||||
## C# - NuGet
|
## C# - NuGet
|
||||||
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.nuget/packages
|
||||||
|
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-nuget-
|
||||||
|
```
|
||||||
|
|
||||||
|
Depending on the environment, huge packages might be pre-installed in the global cache folder.
|
||||||
|
If you do not want to include them, consider to move the cache folder like below.
|
||||||
|
>Note: This workflow does not work for projects that require files to be placed in the global.
|
||||||
```yaml
|
```yaml
|
||||||
env:
|
env:
|
||||||
# Use personal cache folder because global cache may have huge packages like Xamarin.
|
|
||||||
# Learn more, see issue #115.
|
|
||||||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v1
|
||||||
|
Loading…
Reference in New Issue
Block a user