@@ -28,12 +28,14 @@ public class ProjectResource : Resource, IResourceWithEnvironment, IResourceWith
2828 /// <param name="name">The name of the resource.</param>
2929 public ProjectResource ( string name ) : base ( name )
3030 {
31- // Add pipeline step annotation to create a build step for this project
31+ // Add pipeline step annotation to create build and push steps for this project
3232 Annotations . Add ( new PipelineStepAnnotation ( ( factoryContext ) =>
3333 {
34+ var steps = new List < PipelineStep > ( ) ;
35+
3436 if ( factoryContext . Resource . IsExcludedFromPublish ( ) )
3537 {
36- return [ ] ;
38+ return steps ;
3739 }
3840
3941 var buildStep = new PipelineStep
@@ -46,28 +48,22 @@ public ProjectResource(string name) : base(name)
4648 DependsOnSteps = [ WellKnownPipelineSteps . BuildPrereq ] ,
4749 Resource = this
4850 } ;
51+ steps . Add ( buildStep ) ;
4952
50- return [ buildStep ] ;
51- } ) ) ;
52-
53- // Add pipeline step annotation to create a push step for this project
54- Annotations . Add ( new PipelineStepAnnotation ( ( factoryContext ) =>
55- {
56- if ( ! this . RequiresImageBuildAndPush ( ) || factoryContext . Resource . IsExcludedFromPublish ( ) )
53+ if ( this . RequiresImageBuildAndPush ( ) )
5754 {
58- return [ ] ;
55+ var pushStep = new PipelineStep
56+ {
57+ Name = $ "push-{ name } ",
58+ Action = ctx => PipelineStepHelpers . PushImageToRegistryAsync ( this , ctx ) ,
59+ Tags = [ WellKnownPipelineTags . PushContainerImage ] ,
60+ RequiredBySteps = [ WellKnownPipelineSteps . Push ] ,
61+ Resource = this
62+ } ;
63+ steps . Add ( pushStep ) ;
5964 }
6065
61- var pushStep = new PipelineStep
62- {
63- Name = $ "push-{ name } ",
64- Action = ctx => PipelineStepHelpers . PushImageToRegistryAsync ( this , ctx ) ,
65- Tags = [ WellKnownPipelineTags . PushContainerImage ] ,
66- RequiredBySteps = [ WellKnownPipelineSteps . Push ] ,
67- Resource = this
68- } ;
69-
70- return [ pushStep ] ;
66+ return steps ;
7167 } ) ) ;
7268
7369 // Add default container build options annotation
0 commit comments