1919        required : false 
2020        default : false 
2121        type : boolean 
22+       skip-argocd :
23+         description : ' Skip ArgoCD deployment' 
24+         required : false 
25+         default : false 
26+         type : boolean 
27+       skip-monitoring :
28+         description : ' Skip Monitoring deployment' 
29+         required : false 
30+         default : false 
31+         type : boolean 
2232      skip-deployment :
23-         description : ' Skip Kubernetes  deployment' 
33+         description : ' Skip Application  deployment' 
2434        required : false 
2535        default : false 
2636        type : boolean 
4454    outputs :
4555      app-changed : ${{ steps.changes.outputs.app }} 
4656      terraform-changed : ${{ steps.changes.outputs.terraform }} 
47-       k8s-changed : ${{ steps.changes.outputs.k8s }} 
48-       any-changed : ${{ steps.changes.outputs.app == 'true' || steps.changes.outputs.terraform == 'true' || steps.changes.outputs.k8s == 'true' }} 
57+       argocd-changed : ${{ steps.changes.outputs.argocd }} 
58+       deployment-changed : ${{ steps.changes.outputs.deployment }} 
59+       monitoring-changed : ${{ steps.changes.outputs.monitoring }} 
60+       any-changed : ${{ steps.changes.outputs.app == 'true' || steps.changes.outputs.terraform == 'true' || steps.changes.outputs.argocd == 'true' || steps.changes.outputs.deployment == 'true' || steps.changes.outputs.monitoring == 'true' }} 
4961    steps :
5062      - name : Checkout 
5163        uses : actions/checkout@v5 
@@ -69,15 +81,23 @@ jobs:
6981              - '.github/workflows/docker.yml' 
7082            terraform: 
7183              - 'Terraform/**' 
84+               - 'terraform.tfvars' 
7285              - '.github/workflows/terraform.yml' 
73-             k8s : 
86+             argocd : 
7487              - 'argocd/**' 
88+               - '.github/workflows/argocd.yml' 
89+             deployment: 
90+               - 'argocd/application.yml' 
7591              - '.github/workflows/deploy.yml' 
92+             monitoring: 
93+               - 'argocd/monitoring.yml' 
94+               - '.github/workflows/monitoring.yml' 
7695
96+    #  App changes: CI + Docker only
7797  ci :
7898    name : Run CI Tests 
7999    needs : [detect-changes] 
80-     if : ${{ !inputs.skip-tests && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true' || github.event_name == 'workflow_dispatch' ) }} 
100+     if : ${{ !inputs.skip-tests && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true') }} 
81101    uses : ./.github/workflows/ci.yml 
82102    secrets : inherit 
83103    permissions :
88108
89109  docker :
90110    name : Build Docker Image 
91-     if : ${{ !inputs.skip-docker && (success() || inputs.skip-tests) && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true' || github.event_name == 'workflow_dispatch' ) }} 
111+     if : ${{ !inputs.skip-docker && (success() || inputs.skip-tests) && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true') }} 
92112    needs : [ci, detect-changes] 
93113    permissions :
94114      contents : write 
@@ -100,10 +120,11 @@ jobs:
100120    with :
101121      push-image : true 
102122
123+   #  Terraform changes: Terraform + ArgoCD + Deploy + Monitoring
103124  terraform :
104125    name : Deploy Infrastructure 
105-     if : ${{ !inputs.skip-terraform && (success() || ( inputs.skip-tests && inputs.skip-docker)) && (inputs. force-all || needs.detect-changes.outputs.terraform-changed == 'true' || github.event_name == 'workflow_dispatch ') }} 
106-     needs : [docker,  detect-changes] 
126+     if : ${{ !inputs.skip-terraform && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true') }} 
127+     needs : [detect-changes] 
107128    uses : ./.github/workflows/terraform.yml 
108129    secrets : inherit 
109130    permissions :
@@ -114,16 +135,52 @@ jobs:
114135    with :
115136      terraform-action : ' apply' 
116137
117-   deploy :
138+   #  ArgoCD changes OR when terraform changes
139+   argocd :
140+     name : Deploy ArgoCD Applications 
141+     if : ${{ !inputs.skip-argocd && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.argocd-changed == 'true') }}  
142+     needs : [detect-changes, terraform] 
143+     uses : ./.github/workflows/argocd.yml 
144+     secrets : inherit 
145+     permissions :
146+       contents : write 
147+       packages : write 
148+       id-token : write 
149+       actions : read 
150+ 
151+   #  Deploy when: terraform changes OR application.yml changes
152+   deployment :
118153    name : Deploy Application 
119-     if : ${{ !inputs.skip-deployment && (success() || ( inputs.skip-tests && inputs.skip-docker && inputs.skip-terraform)) && (inputs. force-all || needs.detect-changes.outputs.k8s -changed == 'true' || needs.detect-changes.outputs.app -changed == 'true' || github.event_name == 'workflow_dispatch ') }} 
120-     needs : [terraform, docker,  detect-changes] 
154+     if : ${{ !inputs.skip-deployment && (inputs.force-all || needs.detect-changes.outputs.terraform -changed == 'true' || needs.detect-changes.outputs.deployment -changed == 'true') }} 
155+     needs : [detect-changes, argocd ] 
121156    uses : ./.github/workflows/deploy.yml 
122157    secrets : inherit 
123158    permissions :
124159      contents : write 
125160      packages : write 
126161      id-token : write 
127162      actions : read 
128-     with :
129-       image-tag : ${{ github.sha }} 
163+ 
164+   #  Monitoring when: terraform changes OR monitoring.yml changes  
165+   monitoring :
166+     name : Deploy Monitoring Stack 
167+     if : ${{ !inputs.skip-monitoring && (inputs.force-all || needs.detect-changes.outputs.terraform-changed == 'true' || needs.detect-changes.outputs.monitoring-changed == 'true') }} 
168+     needs : [detect-changes, argocd] 
169+     uses : ./.github/workflows/monitoring.yml 
170+     secrets : inherit 
171+     permissions :
172+       contents : write 
173+       packages : write 
174+       id-token : write 
175+       actions : read 
176+ 
177+   #  Print service endpoints when any deployment happens
178+   show-endpoints :
179+     name : Show Service Endpoints 
180+     if : always() && needs.detect-changes.outputs.any-changed == 'true' && (needs.argocd.result == 'success' || needs.deployment.result == 'success' || needs.monitoring.result == 'success') 
181+     needs : [detect-changes, argocd, deployment, monitoring] 
182+     uses : ./.github/workflows/endpoints.yml 
183+     secrets : inherit 
184+     permissions :
185+       contents : read 
186+       id-token : write 
0 commit comments