Skip to content

Commit

Permalink
#3: Fix promise + name
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Sep 22, 2019
1 parent ce52d7e commit 6cd454b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

const child_process = require('child_process');

const build = inputs => {
console.log('Building docker image');
const imageName = `${inputs.name}:${inputs.tag}`;
const build = imageName => {
console.log(`Building docker image: ${imageName}`);
child_process.execSync(`docker build -t ${imageName} .`)
};

Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ const canPerformAction = inputs => {
return true;
};

const run = () => {
const run = async () => {
const inputs = loadInputs();
if (canPerformAction(inputs)) {
const tagName = tag.computeTagName(inputs);
const tagName = await tag.computeTagName(inputs);
console.log(`Tag name for image: ${tagName}`);
docker.build(inputs);
const imageName = `${inputs.name}:${tagName}`;
docker.build(imageName);
docker.login(inputs);
docker.push(inputs);
console.log('Done!');
Expand Down
4 changes: 2 additions & 2 deletions src/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const defaultTagName = () =>
.replace('refs/tags/', '')
.replace('refs/pull/', '');

const computeTagName = inputs => {
const computeTagName = async inputs => {
if (inputs.tag) {
return inputs.tag;
} else if (inputs.tagScript) {
return script(inputs.tagScript);
return await script(inputs.tagScript);
}
return defaultTagName();
};
Expand Down

0 comments on commit 6cd454b

Please sign in to comment.