Skip to content

Commit 63f2e57

Browse files
committed
setup regctl and undock
Signed-off-by: CrazyMax <[email protected]>
1 parent b7bb1d4 commit 63f2e57

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,27 @@ jobs:
305305
docker info
306306
env:
307307
DOCKER_HOST: ${{ steps.setup_docker.outputs.tcp }}
308+
309+
undock-regctl-version:
310+
runs-on: ubuntu-latest
311+
strategy:
312+
fail-fast: false
313+
matrix:
314+
undock_version:
315+
- ''
316+
- v0.9.0
317+
regctl_version:
318+
- ''
319+
- v0.8.2
320+
steps:
321+
-
322+
name: Checkout
323+
uses: actions/checkout@v4
324+
-
325+
name: Set up Docker
326+
uses: ./
327+
with:
328+
version: type=image
329+
env:
330+
UNDOCK_VERSION: ${{ matrix.undock_version }}
331+
REGCTL_VERSION: ${{ matrix.regctl_version }}

src/main.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ import * as core from '@actions/core';
55
import * as actionsToolkit from '@docker/actions-toolkit';
66
import {Install} from '@docker/actions-toolkit/lib/docker/install';
77
import {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

913
import * as context from './context';
1014
import * as stateHelper from './state-helper';
1115

16+
const regctlDefaultVersion = 'v0.8.3';
17+
const undockDefaultVersion = 'v0.10.0';
18+
1219
actionsToolkit.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

Comments
 (0)