1
1
import * as Github from '@octokit/rest' ;
2
- import { isDryRun , shouldPerform } from 'dryrun' ;
2
+ import { shouldPerform } from 'dryrun' ;
3
3
import * as inquirer from 'inquirer' ;
4
4
import * as ora from 'ora' ;
5
5
import { Arguments , Argv } from 'yargs' ;
@@ -41,7 +41,7 @@ export const builder = (yargs: Argv) =>
41
41
SpecialTarget . All ,
42
42
SpecialTarget . None ,
43
43
] ) ,
44
- default : 'all' ,
44
+ default : SpecialTarget . All ,
45
45
description : 'Publish to this target' ,
46
46
type : 'string' ,
47
47
} )
@@ -311,10 +311,12 @@ async function waitForTheBuildToSucceed(
311
311
*
312
312
* @param zeus Zeus store object
313
313
* @param revision Git revision SHA
314
+ * @param targetNames A list of target names to publish
314
315
*/
315
316
async function printRevisionSummary (
316
317
zeus : ZeusStore ,
317
- revision : string
318
+ revision : string ,
319
+ targetNames : string [ ]
318
320
) : Promise < void > {
319
321
const artifacts = await zeus . listArtifactsForRevision ( revision ) ;
320
322
const artifactData = artifacts . map ( ar => [ ar . name , ar . updated_at || '' ] ) ;
@@ -326,13 +328,19 @@ async function printRevisionSummary(
326
328
} ,
327
329
artifactData
328
330
) ;
329
- logger . info ( 'Available files:' , table . toString ( ) ) ;
331
+
332
+ logger . info ( `Available files: \n${ table . toString ( ) } \n` ) ;
333
+
334
+ logger . info ( 'Publishing to targets:' ) ;
335
+ // TODO init all targets earlier
336
+ targetNames . forEach ( target => logger . info ( ` - ${ target } ` ) ) ;
337
+ logger . info ( ' ' ) ;
330
338
331
339
if ( hasInput ( ) ) {
332
340
const questions = [
333
341
{
334
342
default : false ,
335
- message : 'Is it OK to proceed with publishing ?' ,
343
+ message : 'Is it OK to proceed?' ,
336
344
name : 'readyToPublish' ,
337
345
type : 'confirm' ,
338
346
} ,
@@ -453,9 +461,6 @@ async function handleReleaseBranch(
453
461
*/
454
462
export async function publishMain ( argv : PublishOptions ) : Promise < any > {
455
463
logger . debug ( 'Argv:' , JSON . stringify ( argv ) ) ;
456
- if ( isDryRun ( ) ) {
457
- logger . info ( '[dry-run] Dry-run mode is on!' ) ;
458
- }
459
464
checkMinimalConfigVersion ( ) ;
460
465
checkPrerequisites ( ) ;
461
466
@@ -500,8 +505,6 @@ export async function publishMain(argv: PublishOptions): Promise<any> {
500
505
// Check status of all CI builds linked to the revision
501
506
await checkRevisionStatus ( zeus , revision , argv . noStatusCheck ) ;
502
507
503
- await printRevisionSummary ( zeus , revision ) ;
504
-
505
508
// Find targets
506
509
const targetList : string [ ] = ( typeof argv . target === 'string'
507
510
? [ argv . target ]
@@ -518,7 +521,8 @@ export async function publishMain(argv: PublishOptions): Promise<any> {
518
521
}
519
522
520
523
let targetConfigList = config . targets || [ ] ;
521
- if ( targetList [ 0 ] !== 'all' ) {
524
+
525
+ if ( targetList [ 0 ] !== SpecialTarget . All ) {
522
526
targetConfigList = targetConfigList . filter (
523
527
( targetConf : { [ key : string ] : any } ) =>
524
528
targetList . indexOf ( targetConf . name ) > - 1
@@ -530,6 +534,13 @@ export async function publishMain(argv: PublishOptions): Promise<any> {
530
534
logger . warn ( 'No valid targets detected! Exiting.' ) ;
531
535
return undefined ;
532
536
}
537
+
538
+ await printRevisionSummary (
539
+ zeus ,
540
+ revision ,
541
+ targetConfigList . map ( t => t . name || '__undefined__' )
542
+ ) ;
543
+
533
544
await publishToTargets (
534
545
githubConfig ,
535
546
newVersion ,
0 commit comments