ci(deploy): add change detection to skip unaffected workflows
Add a new job 'detect-changes' to check modified paths and conditionally run bot/api workflows
This commit is contained in:
@@ -6,7 +6,30 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
detect-changes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
bot: ${{ steps.filter.outputs.bot }}
|
||||||
|
api: ${{ steps.filter.outputs.api }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check for changes
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
bot:
|
||||||
|
- 'apps/bot/**'
|
||||||
|
- 'packages/**'
|
||||||
|
api:
|
||||||
|
- 'apps/api/**'
|
||||||
|
- 'packages/**'
|
||||||
|
|
||||||
build-and-deploy-bot:
|
build-and-deploy-bot:
|
||||||
|
needs: detect-changes
|
||||||
|
if: needs.detect-changes.outputs.bot == 'true'
|
||||||
env:
|
env:
|
||||||
DOCKER_LATEST: latest
|
DOCKER_LATEST: latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -54,6 +77,8 @@ jobs:
|
|||||||
}'
|
}'
|
||||||
|
|
||||||
build-and-deploy-api:
|
build-and-deploy-api:
|
||||||
|
needs: detect-changes
|
||||||
|
if: needs.detect-changes.outputs.api == 'true'
|
||||||
env:
|
env:
|
||||||
DOCKER_LATEST: latest
|
DOCKER_LATEST: latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
Reference in New Issue
Block a user