import * as os from 'os'; import * as core from '@actions/core'; import {getInputs, Inputs} from './context'; import * as docker from './docker'; import * as stateHelper from './state-helper'; async function run(): Promise { try { if (os.platform() !== 'linux') { core.setFailed('Only supported on linux platform'); return; } let inputs: Inputs = await getInputs(); stateHelper.setRegistry(inputs.registry); stateHelper.setLogout(inputs.logout); await docker.login(inputs.registry, inputs.username, inputs.password); } catch (error) { core.setFailed(error.message); } } async function logout(): Promise { if (!stateHelper.logout) { return; } await docker.logout(stateHelper.registry); } if (!stateHelper.IsPost) { run(); } else { logout(); }