From da3da999641ee4769165e0a2f1816067d92b3d57 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 20 Aug 2020 16:14:02 +0200 Subject: [PATCH] Builtin exec --- dist/index.js | 11 ++++++----- src/main.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 57fd99a..4401305 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1074,8 +1074,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", { value: true }); const os = __importStar(__webpack_require__(87)); const core = __importStar(__webpack_require__(470)); +const exec = __importStar(__webpack_require__(986)); const ecr = __importStar(__webpack_require__(34)); -const exec = __importStar(__webpack_require__(807)); +const execm = __importStar(__webpack_require__(807)); const stateHelper = __importStar(__webpack_require__(153)); function run() { return __awaiter(this, void 0, void 0, function* () { @@ -1090,12 +1091,12 @@ function run() { const username = core.getInput('username'); const password = core.getInput('password', { required: true }); if (yield ecr.isECR(registry)) { - yield exec.exec('aws', ['--version'], false); + yield exec.exec('aws', ['--version']); const ecrRegion = yield ecr.getRegion(registry); process.env.AWS_ACCESS_KEY_ID = username; process.env.AWS_SECRET_ACCESS_KEY = password; core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`); - yield exec.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { + yield execm.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } @@ -1114,7 +1115,7 @@ function run() { else { core.info(`🔑 Logging into DockerHub...`); } - yield exec.exec('docker', loginArgs, true).then(res => { + yield execm.exec('docker', loginArgs, true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } @@ -1132,7 +1133,7 @@ function logout() { if (!stateHelper.logout) { return; } - yield exec.exec('docker', ['logout', stateHelper.registry], false).then(res => { + yield execm.exec('docker', ['logout', stateHelper.registry], false).then(res => { if (res.stderr != '' && !res.success) { core.warning(res.stderr); } diff --git a/src/main.ts b/src/main.ts index 79d3a84..054e350 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,9 @@ import * as os from 'os'; import * as core from '@actions/core'; +import * as exec from '@actions/exec'; import * as ecr from './ecr'; -import * as exec from './exec'; +import * as execm from './exec'; + import * as stateHelper from './state-helper'; async function run(): Promise { @@ -19,13 +21,13 @@ async function run(): Promise { const password: string = core.getInput('password', {required: true}); if (await ecr.isECR(registry)) { - await exec.exec('aws', ['--version'], false); + await exec.exec('aws', ['--version']); const ecrRegion = await ecr.getRegion(registry); process.env.AWS_ACCESS_KEY_ID = username; process.env.AWS_SECRET_ACCESS_KEY = password; core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`); - await exec.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { + await execm.exec('aws', ['ecr', 'get-login', '--region', ecrRegion, '--no-include-email'], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } @@ -43,7 +45,7 @@ async function run(): Promise { } else { core.info(`🔑 Logging into DockerHub...`); } - await exec.exec('docker', loginArgs, true).then(res => { + await execm.exec('docker', loginArgs, true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr); } @@ -59,7 +61,7 @@ async function logout(): Promise { if (!stateHelper.logout) { return; } - await exec.exec('docker', ['logout', stateHelper.registry], false).then(res => { + await execm.exec('docker', ['logout', stateHelper.registry], false).then(res => { if (res.stderr != '' && !res.success) { core.warning(res.stderr); }