Skip to content

Commit

Permalink
ci: Fix prerelease canary builds (#501)
Browse files Browse the repository at this point in the history
* ci: Account for variable preid in canary script regex

* ci: Use major version for canary build if on a prerelease branch

* ci: Fix boolean condition order of operations
  • Loading branch information
anicholls committed Mar 9, 2020
1 parent 52a69b0 commit 650faff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ stages:
if: type = pull_request

- name: trunk
if: branch = master OR branch =~ /^prerelease\// AND type != pull_request
if: (branch = master OR branch =~ /^prerelease\//) AND type != pull_request

- name: tag
if: branch =~ /^v\d+\.\d+(\.\d+)?(-\S*)?$/ AND tag IS present
Expand Down
17 changes: 13 additions & 4 deletions utils/publish-canary.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const {
TRAVIS_BUILD_URL = 'https://travis-ci.org/Workday/canvas-kit/branches',
} = process.env;

const regex = /@workday\/[a-z-]*@(\d*.\d*.\d*-next.\d*\+\w*)/gm;
const data = {};
let preid;

Expand All @@ -24,7 +23,17 @@ if (TRAVIS_BRANCH === 'master') {
process.exit(1);
}

cmd(`yarn lerna publish --yes --force-publish="*" --canary --preid ${preid} --dist-tag ${preid}`)
const regex = new RegExp('@workday\\/[a-z-]*@(\\d*.\\d*.\\d*-' + preid + '.\\d*\\+\\w*)', 'g');
const lernaFlags = [
`--yes`,
`--force-publish="*"`,
`--canary`,
`--preid ${preid}`,
`--dist-tag ${preid}`,
preid === 'prerelease' ? 'major' : '',
];

cmd(`yarn lerna publish ${lernaFlags.join(' ')}`)
.then(output => {
console.log(output);

Expand All @@ -40,8 +49,8 @@ cmd(`yarn lerna publish --yes --force-publish="*" --canary --preid ${preid} --di
json: {
attachments: [
{
fallback: 'Plain-text summary of the attachment.',
color: '#2eb886',
fallback: `New canary build published (v${data.version})`,
color: 'good',
author_name: `New canary build published (v${data.version})`,
author_link: TRAVIS_BUILD_URL,
title: `Merge commit ${sha}`,
Expand Down

0 comments on commit 650faff

Please sign in to comment.