mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 23:58:41 +08:00 
			
		
		
		
	add PowerShell examples
This commit is contained in:
		
							parent
							
								
									d606e039ae
								
							
						
					
					
						commit
						38bf08d269
					
				
							
								
								
									
										25
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								examples.md
									
									
									
									
									
								
							| 
						 | 
					@ -17,6 +17,7 @@
 | 
				
			||||||
  - [Node - Yarn 2](#node---yarn-2)
 | 
					  - [Node - Yarn 2](#node---yarn-2)
 | 
				
			||||||
  - [OCaml/Reason - esy](#ocamlreason---esy)
 | 
					  - [OCaml/Reason - esy](#ocamlreason---esy)
 | 
				
			||||||
  - [PHP - Composer](#php---composer)
 | 
					  - [PHP - Composer](#php---composer)
 | 
				
			||||||
 | 
					  - [PowerShell](#powershell)
 | 
				
			||||||
  - [Python - pip](#python---pip)
 | 
					  - [Python - pip](#python---pip)
 | 
				
			||||||
    - [Simple example](#simple-example)
 | 
					    - [Simple example](#simple-example)
 | 
				
			||||||
    - [Multiple OSes in a workflow](#multiple-oss-in-a-workflow)
 | 
					    - [Multiple OSes in a workflow](#multiple-oss-in-a-workflow)
 | 
				
			||||||
| 
						 | 
					@ -295,6 +296,30 @@ Esy allows you to export built dependencies and import pre-built dependencies.
 | 
				
			||||||
      ${{ runner.os }}-composer-
 | 
					      ${{ runner.os }}-composer-
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## PowerShell
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For PowerShell, the cache directory will vary by OS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Locations:
 | 
				
			||||||
 | 
					 - Ubuntu: `~/.local/share/powershell/Modules`
 | 
				
			||||||
 | 
					 - Windows: `~\Documents\PowerShell\Modules`
 | 
				
			||||||
 | 
					 - macOS: `~/.local/share/powershell/Modules`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					- name: Get PowerShell Cache Directory
 | 
				
			||||||
 | 
					  id: powershell-cache
 | 
				
			||||||
 | 
					- uses: actions/cache@v2
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    path: "~/.local/share/powershell/Modules"
 | 
				
			||||||
 | 
					    key: ${{ runner.os }}-PS-SqlServer-PSScriptAnalyzer
 | 
				
			||||||
 | 
					- name: Install PowerShell modules
 | 
				
			||||||
 | 
					  if: steps.powershell-cache.outputs.cache-hit != 'true'
 | 
				
			||||||
 | 
					  shell: pwsh
 | 
				
			||||||
 | 
					  run: |
 | 
				
			||||||
 | 
					    Set-PSRepository PSGallery -InstallationPolicy Trusted
 | 
				
			||||||
 | 
					    Install-Module SqlServer, PSScriptAnalyzer -ErrorAction Stop
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Python - pip
 | 
					## Python - pip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For pip, the cache directory will vary by OS. See https://pip.pypa.io/en/stable/reference/pip_install/#caching
 | 
					For pip, the cache directory will vary by OS. See https://pip.pypa.io/en/stable/reference/pip_install/#caching
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user