Skip to content

Commit

Permalink
Merge d97fe76 into ba8e51e
Browse files Browse the repository at this point in the history
  • Loading branch information
anicholls authored May 5, 2020
2 parents ba8e51e + d97fe76 commit cc0462f
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions utils/publish-canary.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ if (TRAVIS_BRANCH === 'master') {
process.exit(1);
}

const regex = new RegExp('@workday\\/[a-z-]*@(\\d*.\\d*.\\d*-' + preid + '.\\d*\\+\\w*)', 'g');

cmd('git rev-parse --short HEAD')
.then(sha => {
data.sha = sha.trim();
Expand All @@ -43,6 +41,10 @@ cmd('git rev-parse --short HEAD')
.then(output => {
console.log(output);

const regex = new RegExp(
`@workday\\/[a-z-]*@(\\d*.\\d*.\\d*-${preid}.${data.sha}.\\d*\\+\\w*)`,
'g'
);
data.packages = output.match(regex);
data.version = regex.exec(data.packages[0])[1];

Expand Down Expand Up @@ -73,5 +75,31 @@ cmd('git rev-parse --short HEAD')
})
.catch(err => {
console.error(err);

request.post(
SLACK_WEBHOOK,
{
json: {
attachments: [
{
fallback: `Canary publish failed (v${data.version})`,
color: 'danger',
author_name: `Canary publish failed (v${data.version})`,
author_link: TRAVIS_BUILD_URL,
title: `Merge commit ${data.sha}`,
title_link: `https://github.com/Workday/canvas-kit/commit/${data.sha}`,
text: `\`\`\`${err}\`\`\`\n`,
ts: Date.now(),
},
],
},
},
(error, response, body) => {
if (error) {
throw error;
}
}
);

process.exit(1);
});

0 comments on commit cc0462f

Please sign in to comment.