Skip to content

Commit

Permalink
Update CD and CI workflows for source change detection
Browse files Browse the repository at this point in the history
- Added condition to deploy job in CD workflow based on source changes
- Updated build-and-test job in CI workflow to identify source changes
  • Loading branch information
winromulus committed Jun 15, 2024
1 parent 1fbdc9d commit 79f5836
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest
needs: build-and-test
if: >
needs.build-and-test.outputs.src_changed == 'true' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
(github.ref == 'refs/heads/main' ||
Expand All @@ -24,19 +25,6 @@ jobs:
with:
fetch-depth: 0

- name: src - identify source changes
id: source-changed-filter
uses: dorny/paths-filter@v2
with:
base: ${{ github.ref }}
filters: |
src:
- 'src/**'
solution:
- 'ES.FX.sln'
build:
- 'Directory.Build.props'
- name: build
uses: ./.github/actions/build
with:
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,35 @@ jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
outputs:
src_changed: ${{ steps.src_changed.outputs.changes }}
steps:

- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
fetch-depth: 0

- name: src - identify source changes
id: src_changed
uses: dorny/paths-filter@v2
with:
base: ${{ github.ref }}
filters: |
src:
- 'src/**'
solution:
- 'ES.FX.sln'
build:
- 'Directory.Build.props'
- name: build
uses: ./.github/actions/build
if: steps.src_changed.outputs.src == 'true'
with:
configuration: Debug
useVersioning: false

- name: test
if: steps.src_changed.outputs.src == 'true'
uses: ./.github/actions/test

0 comments on commit 79f5836

Please sign in to comment.