Skip to content

Commit

Permalink
🏗 Add nice colors to release tagger logs (#36200)
Browse files Browse the repository at this point in the history
* log

* comment
  • Loading branch information
estherkim committed Sep 29, 2021
1 parent 39162ab commit 16afb0f
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions build-system/release-tagger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
* 2. head (AMP version)
* 3. base (AMP version)
* 4. channel (beta-percent|stable|lts)
* 5. time (in UTC, Y-%m-%d %H:%M:%S)
*/

const [action, head, base, channel, time] = process.argv.slice(2);

const dedent = require('dedent');
const {addLabels, removeLabels} = require('./label-pull-requests');
const {createOrUpdateTracker} = require('./update-issue-tracker');
const {cyan, magenta} = require('kleur/colors');
const {log} = require('../common/logging');
const {makeRelease} = require('./make-release');
const {publishRelease, rollbackRelease} = require('./update-release');
Expand All @@ -21,28 +24,47 @@ const {publishRelease, rollbackRelease} = require('./update-release');
* @return {Promise<void>}
*/
async function _promote() {
log(
cyan(dedent`Release tagger triggered with inputs:
action: ${magenta(action)}
head: ${magenta(head)}
base: ${magenta(base)}
channel: ${magenta(channel)}
time: ${magenta(time)}`)
);

const supportedChannels = ['beta-opt-in', 'beta-percent', 'stable', 'lts'];
if (!supportedChannels.includes(channel)) {
return;
}

if (channel == 'stable') {
await publishRelease(head);
log('Published release', head);
log('Published release', magenta(head));
}

if (channel == 'beta-opt-in') {
await makeRelease(head, base, channel);
log('Created release', head);
log('Created release', magenta(head));
}

if (['beta-percent', 'stable', 'lts'].includes(channel)) {
await addLabels(head, base, channel);
log('Labeled PRs for release', head, 'and channel', channel);
log(
'Labeled PRs for release',
magenta(head),
'and channel',
magenta(channel)
);
}

await createOrUpdateTracker(head, base, channel, time);
log('Updated issue tracker for release', head, 'and channel', channel);
log(
'Updated issue tracker for release',
magenta(head),
'and channel',
magenta(channel)
);
}

/**
Expand Down

0 comments on commit 16afb0f

Please sign in to comment.