mirror of
https://github.com/docker/setup-docker-action.git
synced 2026-02-14 14:28:40 +01:00
setup regctl and undock
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user