@@ -5,10 +5,17 @@ import * as core from '@actions/core';
55import * as actionsToolkit from '@docker/actions-toolkit' ;
66import { Install } from '@docker/actions-toolkit/lib/docker/install' ;
77import { Docker } from '@docker/actions-toolkit/lib/docker/docker' ;
8+ import { Install as RegclientInstall } from '@docker/actions-toolkit/lib/regclient/install' ;
9+ import { Regctl } from '@docker/actions-toolkit/lib/regclient/regctl' ;
10+ import { Install as UndockInstall } from '@docker/actions-toolkit/lib/undock/install' ;
11+ import { Undock } from '@docker/actions-toolkit/lib/undock/undock' ;
812
913import * as context from './context' ;
1014import * as stateHelper from './state-helper' ;
1115
16+ const regctlDefaultVersion = 'v0.8.3' ;
17+ const undockDefaultVersion = 'v0.10.0' ;
18+
1219actionsToolkit . run (
1320 // main
1421 async ( ) => {
@@ -19,6 +26,29 @@ actionsToolkit.run(
1926 throw new Error ( `'default' context cannot be used.` ) ;
2027 }
2128
29+ if ( input . source . type === 'image' ) {
30+ await core . group ( `Download and install regctl` , async ( ) => {
31+ const regclientInstall = new RegclientInstall ( ) ;
32+ const regclientBinPath = await regclientInstall . download (
33+ process . env . REGCTL_VERSION && process . env . REGCTL_VERSION . trim ( )
34+ ? process . env . REGCTL_VERSION
35+ : regctlDefaultVersion ,
36+ true
37+ ) ;
38+ await regclientInstall . install ( regclientBinPath ) ;
39+ } ) ;
40+ await core . group ( `Download and install undock` , async ( ) => {
41+ const undockInstall = new UndockInstall ( ) ;
42+ const undockBinPath = await undockInstall . download (
43+ process . env . UNDOCK_VERSION && process . env . UNDOCK_VERSION . trim ( )
44+ ? process . env . UNDOCK_VERSION
45+ : undockDefaultVersion ,
46+ true
47+ ) ;
48+ await undockInstall . install ( undockBinPath ) ;
49+ } ) ;
50+ }
51+
2252 let tcpPort : number | undefined ;
2353 let tcpAddress : string | undefined ;
2454 if ( input . tcpPort ) {
@@ -32,7 +62,9 @@ actionsToolkit.run(
3262 rootless : input . rootless ,
3363 contextName : input . context || 'setup-docker-action' ,
3464 daemonConfig : input . daemonConfig ,
35- localTCPPort : tcpPort
65+ localTCPPort : tcpPort ,
66+ regctl : new Regctl ( ) ,
67+ undock : new Undock ( )
3668 } ) ;
3769 let toolDir ;
3870 if ( ! ( await Docker . isAvailable ( ) ) || input . source ) {
@@ -71,7 +103,9 @@ actionsToolkit.run(
71103 return ;
72104 }
73105 const install = new Install ( {
74- runDir : stateHelper . runDir
106+ runDir : stateHelper . runDir ,
107+ regctl : new Regctl ( ) ,
108+ undock : new Undock ( )
75109 } ) ;
76110 await install . tearDown ( ) ;
77111 }
0 commit comments