11import chalk from 'chalk' ;
22import CiCdGenerator from 'generator-jhipster/esm/generators/ci-cd' ;
3+ import { GITHUB , GITLAB } from '../generator-dotnetcore-constants.mjs' ;
34import {
45 PRIORITY_PREFIX ,
56 PROMPTING_PRIORITY ,
@@ -28,8 +29,8 @@ export default class extends CiCdGenerator {
2829 if ( this . ciType ) return ;
2930
3031 const ciTypeChoices = [
31- { value : 'gitlab' , name : 'Gitlab CI ' , } ,
32- { value : 'github' , name : 'Github Action ' , } ,
32+ { value : GITHUB , name : 'Github Action ' , } ,
33+ { value : GITLAB , name : 'Gitlab CI ' , } ,
3334 ] ;
3435
3536 const answers = await this . prompt ( [
@@ -38,7 +39,7 @@ export default class extends CiCdGenerator {
3839 name : 'ciType' ,
3940 message : `What CI/CD pipeline do you want to generate ?` ,
4041 choices : ciTypeChoices ,
41- default : 'github' ,
42+ default : GITHUB ,
4243 } ,
4344 ] ) ;
4445 this . ciType = this . blueprintConfig . ciType = answers . ciType ;
@@ -63,7 +64,12 @@ export default class extends CiCdGenerator {
6364 async writingCiFiles ( ) {
6465 await this . writeFiles ( {
6566 sections : {
66- files : [ { templates : [ 'template-file-app' ] } ] ,
67+ files : [
68+ {
69+ condition : ctx => ctx . ciType === GITHUB ,
70+ templates : [ '.github/workflows/dotnet.yml' ]
71+ } ,
72+ ] ,
6773 } ,
6874 context : this ,
6975 } ) ;
0 commit comments