Skip to content

Commit c5c871d

Browse files
committed
ci(docker): add path filters to avoid unnecessary builds
Only trigger Docker build when code actually changes: - Rust source code (src/, crates/, benches/) - Dependencies (Cargo.toml, Cargo.lock) - Docker configuration (Dockerfile, .dockerignore) Skip build for: - Documentation changes (*.md, docs/) - CI workflow updates (docker-publish.yml itself) - Other non-code files This saves GitHub Actions minutes and avoids waste builds.
1 parent 85a15f5 commit c5c871d

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,31 @@ on:
44
push:
55
branches: [main]
66
tags: ['v*']
7+
paths:
8+
# Only build Docker image when code actually changes
9+
- 'src/**'
10+
- 'crates/**'
11+
- 'benches/**'
12+
- 'Cargo.toml'
13+
- 'Cargo.lock'
14+
- 'Dockerfile'
15+
- '.dockerignore'
16+
# Exclude documentation changes
17+
- '!**.md'
18+
- '!docs/**'
719
pull_request:
820
branches: [main]
921
paths:
10-
- 'Dockerfile'
11-
- '.github/workflows/docker-publish.yml'
22+
# Same filters for PR builds
1223
- 'src/**'
24+
- 'crates/**'
25+
- 'benches/**'
1326
- 'Cargo.toml'
1427
- 'Cargo.lock'
28+
- 'Dockerfile'
29+
- '.dockerignore'
30+
- '!**.md'
31+
- '!docs/**'
1532
workflow_dispatch:
1633

1734
env:

0 commit comments

Comments
 (0)