mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 10:24:19 +08:00 
			
		
		
		
	add Yarn 2 cache example
This commit is contained in:
		
							parent
							
								
									eed9cfe64d
								
							
						
					
					
						commit
						5474af707f
					
				
							
								
								
									
										19
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								examples.md
									
									
									
									
									
								
							| @ -14,6 +14,7 @@ | |||||||
|     - [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config) |     - [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config) | ||||||
|   - [Node - Lerna](#node---lerna) |   - [Node - Lerna](#node---lerna) | ||||||
|   - [Node - Yarn](#node---yarn) |   - [Node - Yarn](#node---yarn) | ||||||
|  |   - [Node - Yarn 2](#node---yarn-2) | ||||||
|   - [OCaml/Reason - esy](#ocamlreason---esy) |   - [OCaml/Reason - esy](#ocamlreason---esy) | ||||||
|   - [PHP - Composer](#php---composer) |   - [PHP - Composer](#php---composer) | ||||||
|   - [Python - pip](#python---pip) |   - [Python - pip](#python---pip) | ||||||
| @ -231,6 +232,24 @@ The yarn cache directory will depend on your operating system and version of `ya | |||||||
|       ${{ runner.os }}-yarn- |       ${{ runner.os }}-yarn- | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | ## Node - Yarn 2 | ||||||
|  | The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/configuration/yarnrc#cacheFolder for more info. | ||||||
|  | 
 | ||||||
|  | ```yaml | ||||||
|  | - name: Get yarn cache directory path | ||||||
|  |   id: yarn-cache-dir-path | ||||||
|  |   run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||||||
|  | 
 | ||||||
|  | - uses: actions/cache@v2 | ||||||
|  |   id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||||||
|  |   with: | ||||||
|  |     path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||||||
|  |     key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||||||
|  |     restore-keys: | | ||||||
|  |       ${{ runner.os }}-yarn- | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
| ## OCaml/Reason - esy | ## OCaml/Reason - esy | ||||||
| Esy allows you to export built dependencies and import pre-built dependencies. | Esy allows you to export built dependencies and import pre-built dependencies. | ||||||
| ```yaml | ```yaml | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Huáng Jùnliàng
						Huáng Jùnliàng