Solar System - Main Pipeline #73
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-deployment: | |
| description: 'Skip Kubernetes 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 }} | |
| terraform-changed: ${{ steps.changes.outputs.terraform }} | |
| k8s-changed: ${{ steps.changes.outputs.k8s }} | |
| any-changed: ${{ steps.changes.outputs.app == 'true' || steps.changes.outputs.terraform == 'true' || steps.changes.outputs.k8s == 'true' }} | |
| 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' | |
| terraform: | |
| - 'Terraform/**' | |
| - '.github/workflows/terraform.yml' | |
| k8s: | |
| - 'argocd/**' | |
| - '.github/workflows/deploy.yml' | |
| ci: | |
| name: Run CI Tests | |
| needs: [detect-changes] | |
| if: ${{ !inputs.skip-tests && (inputs.force-all || needs.detect-changes.outputs.app-changed == 'true' || github.event_name == 'workflow_dispatch') }} | |
| 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' || github.event_name == 'workflow_dispatch') }} | |
| needs: [ci, detect-changes] | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| uses: ./.github/workflows/docker.yml | |
| secrets: inherit | |
| with: | |
| push-image: true | |
| terraform: | |
| name: Deploy Infrastructure | |
| 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') }} | |
| needs: [docker, detect-changes] | |
| uses: ./.github/workflows/terraform.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| with: | |
| terraform-action: 'apply' | |
| deploy: | |
| name: Deploy Application | |
| 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') }} | |
| needs: [terraform, docker, detect-changes] | |
| uses: ./.github/workflows/deploy.yml | |
| secrets: inherit | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| actions: read | |
| with: | |
| image-tag: ${{ github.sha }} |