Skip to content

Commit

Permalink
Builtin exec
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyMax committed Aug 20, 2020
1 parent b7cd11b commit da3da99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
Expand All @@ -19,13 +21,13 @@ async function run(): Promise<void> {
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);
}
Expand All @@ -43,7 +45,7 @@ async function run(): Promise<void> {
} 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);
}
Expand All @@ -59,7 +61,7 @@ async function logout(): Promise<void> {
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);
}
Expand Down

0 comments on commit da3da99

Please sign in to comment.