mirror of
				https://git.mirrors.martin98.com/https://github.com/docker/setup-docker-action
				synced 2025-10-31 14:51:10 +08:00 
			
		
		
		
	setup regctl and undock
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									b7bb1d4426
								
							
						
					
					
						commit
						63f2e57f85
					
				
							
								
								
									
										24
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -305,3 +305,27 @@ jobs: | ||||
|           docker info | ||||
|         env: | ||||
|           DOCKER_HOST: ${{ steps.setup_docker.outputs.tcp }} | ||||
| 
 | ||||
|   undock-regctl-version: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         undock_version: | ||||
|           - '' | ||||
|           - v0.9.0 | ||||
|         regctl_version: | ||||
|           - '' | ||||
|           - v0.8.2 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker | ||||
|         uses: ./ | ||||
|         with: | ||||
|           version: type=image | ||||
|         env: | ||||
|           UNDOCK_VERSION: ${{ matrix.undock_version }} | ||||
|           REGCTL_VERSION: ${{ matrix.regctl_version }} | ||||
|  | ||||
							
								
								
									
										38
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -5,10 +5,17 @@ import * as core from '@actions/core'; | ||||
| import * as actionsToolkit from '@docker/actions-toolkit'; | ||||
| import {Install} from '@docker/actions-toolkit/lib/docker/install'; | ||||
| import {Docker} from '@docker/actions-toolkit/lib/docker/docker'; | ||||
| import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install'; | ||||
| import {Regctl} from '@docker/actions-toolkit/lib/regclient/regctl'; | ||||
| import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install'; | ||||
| import {Undock} from '@docker/actions-toolkit/lib/undock/undock'; | ||||
| 
 | ||||
| import * as context from './context'; | ||||
| import * as stateHelper from './state-helper'; | ||||
| 
 | ||||
| const regctlDefaultVersion = 'v0.8.3'; | ||||
| const undockDefaultVersion = 'v0.10.0'; | ||||
| 
 | ||||
| actionsToolkit.run( | ||||
|   // main
 | ||||
|   async () => { | ||||
| @ -19,6 +26,29 @@ actionsToolkit.run( | ||||
|       throw new Error(`'default' context cannot be used.`); | ||||
|     } | ||||
| 
 | ||||
|     if (input.source.type === 'image') { | ||||
|       await core.group(`Download and install regctl`, async () => { | ||||
|         const regclientInstall = new RegclientInstall(); | ||||
|         const regclientBinPath = await regclientInstall.download( | ||||
|           process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim() | ||||
|             ? process.env.REGCTL_VERSION | ||||
|             : regctlDefaultVersion, | ||||
|           true | ||||
|         ); | ||||
|         await regclientInstall.install(regclientBinPath); | ||||
|       }); | ||||
|       await core.group(`Download and install undock`, async () => { | ||||
|         const undockInstall = new UndockInstall(); | ||||
|         const undockBinPath = await undockInstall.download( | ||||
|           process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim() | ||||
|             ? process.env.UNDOCK_VERSION | ||||
|             : undockDefaultVersion, | ||||
|           true | ||||
|         ); | ||||
|         await undockInstall.install(undockBinPath); | ||||
|       }); | ||||
|     } | ||||
| 
 | ||||
|     let tcpPort: number | undefined; | ||||
|     let tcpAddress: string | undefined; | ||||
|     if (input.tcpPort) { | ||||
| @ -32,7 +62,9 @@ actionsToolkit.run( | ||||
|       rootless: input.rootless, | ||||
|       contextName: input.context || 'setup-docker-action', | ||||
|       daemonConfig: input.daemonConfig, | ||||
|       localTCPPort: tcpPort | ||||
|       localTCPPort: tcpPort, | ||||
|       regctl: new Regctl(), | ||||
|       undock: new Undock() | ||||
|     }); | ||||
|     let toolDir; | ||||
|     if (!(await Docker.isAvailable()) || input.source) { | ||||
| @ -71,7 +103,9 @@ actionsToolkit.run( | ||||
|       return; | ||||
|     } | ||||
|     const install = new Install({ | ||||
|       runDir: stateHelper.runDir | ||||
|       runDir: stateHelper.runDir, | ||||
|       regctl: new Regctl(), | ||||
|       undock: new Undock() | ||||
|     }); | ||||
|     await install.tearDown(); | ||||
|   } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 CrazyMax
						CrazyMax