mirror of
				https://git.mirrors.martin98.com/https://github.com/docker/setup-docker-action
				synced 2025-10-31 14:51:10 +08:00 
			
		
		
		
	
						commit
						c3a68cbeca
					
				
							
								
								
									
										24
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -50,3 +50,27 @@ jobs: | ||||
|         with: | ||||
|           version: v23.0.0-rc.4 | ||||
|           channel: test | ||||
| 
 | ||||
|   context: | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: | ||||
|           - ubuntu-latest | ||||
|           - macos-latest | ||||
|           - windows-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
|       - | ||||
|         name: Set up Docker | ||||
|         uses: ./ | ||||
|         with: | ||||
|           version: v23.0.0 | ||||
|           context: foo | ||||
|       - | ||||
|         name: Check context | ||||
|         run: | | ||||
|           docker context inspect foo | ||||
|  | ||||
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							| @ -6,8 +6,8 @@ | ||||
| 
 | ||||
| ## About | ||||
| 
 | ||||
| GitHub Action to set up [Docker CE](https://docs.docker.com/engine/). Works on | ||||
| Linux, macOS and Windows. | ||||
| GitHub Action to set up (download and install) [Docker CE](https://docs.docker.com/engine/). | ||||
| Works on Linux, macOS and Windows. | ||||
| 
 | ||||
|  | ||||
| 
 | ||||
| @ -41,10 +41,11 @@ jobs: | ||||
| 
 | ||||
| Following inputs can be used as `step.with` keys | ||||
| 
 | ||||
| | Name      | Type   | Default  | Description                                                                                       | | ||||
| |-----------|--------|----------|---------------------------------------------------------------------------------------------------| | ||||
| | `version` | String | `latest` | Docker CE version (e.g., `v23.0.1`).                                                              | | ||||
| | `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). | | ||||
| | Name      | Type   | Default               | Description                                                                                       | | ||||
| |-----------|--------|-----------------------|---------------------------------------------------------------------------------------------------| | ||||
| | `version` | String | `latest`              | Docker CE version (e.g., `v23.0.1`).                                                              | | ||||
| | `channel` | String | `stable`              | Docker CE [channel](https://download.docker.com/linux/static/) (e.g, `stable`, `edge` or `test`). | | ||||
| | `context` | String | `setup-docker-action` | Docker context name.                                                                              | | ||||
| 
 | ||||
| ## Contributing | ||||
| 
 | ||||
|  | ||||
| @ -22,6 +22,7 @@ describe('getInputs', () => { | ||||
|       { | ||||
|         version: 'v23.0.1', | ||||
|         channel: '', | ||||
|         context: '', | ||||
|       } as context.Inputs | ||||
|     ], | ||||
|     [ | ||||
| @ -29,10 +30,12 @@ describe('getInputs', () => { | ||||
|       new Map<string, string>([ | ||||
|         ['version', 'v23.0.0-rc.4'], | ||||
|         ['channel', 'test'], | ||||
|         ['context', 'foo'], | ||||
|       ]), | ||||
|       { | ||||
|         version: 'v23.0.0-rc.4', | ||||
|         channel: 'test', | ||||
|         context: 'foo', | ||||
|       } as context.Inputs | ||||
|     ] | ||||
|   ])( | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| # https://help.github.com/en/articles/metadata-syntax-for-github-actions | ||||
| name: 'Docker Setup Docker' | ||||
| description: 'Set up Docker' | ||||
| description: 'Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE' | ||||
| author: 'docker' | ||||
| branding: | ||||
|   icon: 'anchor' | ||||
| @ -13,6 +13,9 @@ inputs: | ||||
|   channel: | ||||
|     description: 'Docker CE channel. (e.g, stable, edge or test)' | ||||
|     required: false | ||||
|   context: | ||||
|     description: 'Docker context name. (default setup-docker-action)' | ||||
|     required: false | ||||
| 
 | ||||
| runs: | ||||
|   using: 'node16' | ||||
|  | ||||
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -3,11 +3,13 @@ import * as core from '@actions/core'; | ||||
| export interface Inputs { | ||||
|   version: string; | ||||
|   channel: string; | ||||
|   context: string; | ||||
| } | ||||
| 
 | ||||
| export function getInputs(): Inputs { | ||||
|   return { | ||||
|     version: core.getInput('version'), | ||||
|     channel: core.getInput('channel') | ||||
|     channel: core.getInput('channel'), | ||||
|     context: core.getInput('context') | ||||
|   }; | ||||
| } | ||||
|  | ||||
| @ -15,10 +15,15 @@ actionsToolkit.run( | ||||
|     const input: context.Inputs = context.getInputs(); | ||||
|     const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`); | ||||
| 
 | ||||
|     if (input.context == 'default') { | ||||
|       throw new Error(`'default' context cannot be used.`); | ||||
|     } | ||||
| 
 | ||||
|     const install = new Install({ | ||||
|       runDir: runDir, | ||||
|       version: input.version, | ||||
|       channel: input.channel | ||||
|       version: input.version || 'latest', | ||||
|       channel: input.channel || 'stable', | ||||
|       contextName: input.context || 'setup-docker-action' | ||||
|     }); | ||||
|     let toolDir; | ||||
|     if (!(await Docker.isAvailable()) || input.version) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 CrazyMax
						CrazyMax