Refactor change detection outputs in main pipeline to simplify infras… #86
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Solar System - Main Pipeline | |
| on: | |
| push: # Auto-trigger on push | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| skip-tests: | |
| description: 'Skip CI tests' | |
| required: false | |
| default: false | |
| type: boolean | |
| skip-docker: | |
| description: 'Skip Docker build' | |
| required: false | |
| default: false | |
| type: boolean | |
| skip-terraform: | |
| description: 'Skip Terraform deployment' | |
| required: false | |
| default: false | |
| type: boolean | |
| skip-argocd: | |
| description: 'Skip ArgoCD deployment' | |
| required: false | |
| default: false | |
| type: boolean | |
| skip-monitoring: | |
| description: 'Skip Monitoring deployment' | |
| required: false | |
| default: false | |
| type: boolean | |
| skip-deployment: | |
| description: 'Skip Application deployment' | |
| required: false | |
| default: false | |
| type: boolean | |
| force-all: # Force all workflows | |
| description: 'Force run all workflows (ignore path detection)' | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| jobs: | |
| # Detect what changed | |
| detect-changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| app-changed: ${{ steps.changes.outputs.app }} | |
| infra-changed: ${{ steps.changes.outputs.infra }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - name: Detect file changes | |
| uses: dorny/paths-filter@v2 | |
| id: changes | |
| with: | |
| filters: | | |
| app: | |
| - 'app-controllers/**' | |
| - 'app-test.js' | |
| - 'app.js' | |
| - 'index.html' | |
| - 'Dockerfile' | |
| - 'package*.json' | |
| - 'images/**' | |
| - '.github/workflows/ci.yml' | |
| - '.github/workflows/docker.yml' | |
| infra: | |
| - 'Terraform/**' | |
| - '.github/workflows/terraform.yml' | |
| - '.github/workflows/argocd.yml' | |
| - 'argocd/application.yml' | |
| - '.github/workflows/deploy.yml' | |
| - 'argocd/monitoring.yml' | |
| - '.github/workflows/monitoring.yml' | |
| ci: | |
| name: Run CI Tests | |
| needs: [detect-changes] | |
| if: ${{ !inputs.skip-tests && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true') }} | |
| uses: ./.github/workflows/ci.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| docker: | |
| name: Build Docker Image | |
| if: ${{ !inputs.skip-docker && (success() || inputs.skip-tests) && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true') }} | |
| needs: [ci, detect-changes] | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| uses: ./.github/workflows/docker.yml | |
| secrets: inherit | |
| # Terraform changes: Terraform + ArgoCD + Deploy + Monitoring | |
| terraform: | |
| name: Deploy Infrastructure | |
| if: ${{ !inputs.skip-terraform && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }} | |
| needs: [detect-changes] | |
| uses: ./.github/workflows/terraform.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| # ArgoCD changes OR when terraform changes | |
| argocd: | |
| name: Deploy ArgoCD Applications | |
| if: ${{ !inputs.skip-argocd && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }} | |
| needs: [detect-changes, terraform] | |
| uses: ./.github/workflows/argocd.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| # Deploy when: terraform changes OR application.yml changes | |
| deployment: | |
| name: Deploy Application | |
| if: ${{ !inputs.skip-deployment && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }} | |
| needs: [detect-changes, argocd] | |
| uses: ./.github/workflows/deploy.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| # Monitoring when: terraform changes OR monitoring.yml changes | |
| monitoring: | |
| name: Deploy Monitoring Stack | |
| if: ${{ !inputs.skip-monitoring && (inputs.force-all || needs.detect-changes.outputs.infra-changed == 'true') }} | |
| needs: [detect-changes, argocd] | |
| uses: ./.github/workflows/monitoring.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| # Print service endpoints when any deployment happens | |
| show-endpoints: | |
| name: Show Service Endpoints | |
| if: always() && needs.detect-changes.outputs.infra-changed == 'true' && (needs.argocd.result == 'success' || needs.deployment.result == 'success' || needs.monitoring.result == 'success') | |
| needs: [detect-changes, argocd, deployment, monitoring] | |
| uses: ./.github/workflows/endpoints.yml | |
| secrets: inherit | |
| permissions: | |
| contents: read | |
| id-token: write |