From db4fd25264a95c7943182cc4086f9b8f0fe75b31 Mon Sep 17 00:00:00 2001 From: cyber-Elvis Date: Sun, 5 Oct 2025 10:05:52 +1100 Subject: [PATCH] ci: Backend CI on PRs; linked CD on push to main (needs: backend_cd) --- .github/workflows/CD_linked.yml | 7 ++++++- .github/workflows/backend_ci.yml | 8 ++++++-- .github/workflows/frontend_ci.yml | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CD_linked.yml b/.github/workflows/CD_linked.yml index 500724e9..fedb66e1 100644 --- a/.github/workflows/CD_linked.yml +++ b/.github/workflows/CD_linked.yml @@ -4,7 +4,12 @@ name: CD - Deploy Backend then Frontend to AKS on: push: branches: [ main ] - + paths: + - 'k8s/**' + - 'backend/**' + - 'frontend/**' + - '.github/workflows/CD_linked.yml' + permissions: id-token: write contents: read diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index d69725aa..39be22cc 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -5,8 +5,11 @@ name: Backend CI - Test, Build and Push Images to ACR # Trigger the workflow on pushes to the 'main' branch # You can also add 'pull_request:' to run on PRs on: - # Manual trigger - workflow_dispatch: + pull_request: + branches: [ main ] # or: [ development ] + paths: + - 'backend/**' + - '.github/workflows/backend_ci.yml' # Automatically on pushes to main branch push: @@ -111,6 +114,7 @@ jobs: # Job 2: Build and Push Docker Images (runs only if tests pass) build_and_push_images: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main') runs-on: ubuntu-latest needs: test_and_lint_backends diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index 63da12e6..7e442b38 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -3,8 +3,11 @@ name: Frontend CI - Build & Push Image on: - # Manual trigger - workflow_dispatch: + pull_request: + branches: [ main ] + paths: + - 'frontend/**' + - '.github/workflows/frontend_ci.yml' # Automatically on pushes to main branch push: