Skip to content

Commit

Permalink
Display AWS CLI version
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyMax committed Aug 20, 2020
1 parent 826c451 commit 16b2f90
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion dist/index.js

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

14 changes: 13 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ async function run(): Promise<void> {
const password: string = core.getInput('password', {required: true});

if (await ecr.isECR(registry)) {
await exec.exec('aws', ['--version'], true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
}
core.info(`💡 Using ${res.stdout}`);
});

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}...`);
core.info(`🔑 Logging into AWS ECR region ${ecrRegion}...`);
await exec.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 @@ -37,6 +44,11 @@ async function run(): Promise<void> {
}
loginArgs.push(registry);

if (registry) {
core.info(`🔑 Logging into ${registry}...`);
} else {
core.info(`🔑 Logging into DockerHub...`);
}
await exec.exec('docker', loginArgs, true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
Expand Down

0 comments on commit 16b2f90

Please sign in to comment.