|
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - "*" |
7 | | - paths: |
8 | | - - 'backend/model_server/**' |
9 | | - - 'backend/Dockerfile.model_server' |
10 | 7 |
|
11 | 8 | env: |
12 | 9 | REGISTRY_IMAGE: ${{ contains(github.ref_name, 'cloud') && 'onyxdotapp/onyx-model-server-cloud' || 'onyxdotapp/onyx-model-server' }} |
|
15 | 12 | BUILDKIT_PROGRESS: plain |
16 | 13 |
|
17 | 14 | jobs: |
| 15 | + # 1) Preliminary job to check if the changed files are relevant |
| 16 | + check_model_server_changes: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + changed: ${{ steps.check.outputs.changed }} |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Check if relevant files changed |
| 25 | + id: check |
| 26 | + run: | |
| 27 | + # Default to "false" |
| 28 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 29 | +
|
| 30 | + # Compare the previous commit (github.event.before) to the current one (github.sha) |
| 31 | + # If any file in backend/model_server/** or backend/Dockerfile.model_server is changed, |
| 32 | + # set changed=true |
| 33 | + if git diff --name-only ${{ github.event.before }} ${{ github.sha }} \ |
| 34 | + | grep -E '^backend/model_server/|^backend/Dockerfile.model_server'; then |
| 35 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 36 | + fi |
| 37 | +
|
18 | 38 | build-amd64: |
| 39 | + needs: [check_model_server_changes] |
| 40 | + if: needs.check_model_server_changes.outputs.changed == 'true' |
19 | 41 | runs-on: |
20 | 42 | [runs-on, runner=8cpu-linux-x64, "run-id=${{ github.run_id }}-amd64"] |
21 | 43 | steps: |
|
55 | 77 | provenance: false |
56 | 78 |
|
57 | 79 | build-arm64: |
| 80 | + needs: [check_model_server_changes] |
| 81 | + if: needs.check_model_server_changes.outputs.changed == 'true' |
58 | 82 | runs-on: |
59 | 83 | [runs-on, runner=8cpu-linux-x64, "run-id=${{ github.run_id }}-arm64"] |
60 | 84 | steps: |
|
94 | 118 | provenance: false |
95 | 119 |
|
96 | 120 | merge-and-scan: |
97 | | - needs: [build-amd64, build-arm64] |
| 121 | + needs: [build-amd64, build-arm64, check_model_server_changes] |
| 122 | + if: needs.check_model_server_changes.outputs.changed == 'true' |
98 | 123 | runs-on: ubuntu-latest |
99 | 124 | steps: |
100 | 125 | - name: Login to Docker Hub |
|
0 commit comments