1313 pull_request_target :
1414 branches :
1515 - main
16- - development
16+ paths :
17+ - ' .github/workflows/qcom-container-build-and-upload.yml'
18+ - ' docker/**'
1719
1820 push :
1921 branches :
2022 - main
23+ paths :
24+ - ' .github/workflows/qcom-container-build-and-upload.yml'
25+ - ' docker/**'
2126
2227 workflow_dispatch :
2328
2429permissions :
2530 contents : read
26- security-events : write
2731
2832env :
2933 QCOM_ORG_NAME : " qualcomm-linux"
3236
3337jobs :
3438
35- # Check if this PR changes files in the docker/ folder. If not, there is no point in building and pushing a new image.
36- check-if-build-needed :
37- runs-on : ubuntu-latest
38- outputs :
39- build-needed : ${{ steps.set-output.outputs.build-needed }}
40- steps :
41-
42- - name : Checkout
43- uses : actions/checkout@v4
44- with :
45- ref : ${{github.head_ref}}
46- fetch-depth : 0
47-
48- - name : Check if build is needed
49- id : set-output
50- run : |
51- echo "build-needed=false" >> $GITHUB_OUTPUT
52-
53- if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
54- CHANGED_FILES=$(git diff --name-only origin/main...HEAD)
55- echo "Changed files: $CHANGED_FILES"
56- if [[ $CHANGED_FILES == *"docker/"* ]]; then
57- echo "Build IS needed as docker/ folder changed."
58- echo "build-needed=true" >> $GITHUB_OUTPUT
59- else
60- echo "Build is NOT needed as docker/ folder did not change."
61- echo "build-needed=false" >> $GITHUB_OUTPUT
62- fi
63-
64- elif [[ "${{ github.event_name }}" == "push" ]]; then
65- CHANGED_FILES=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }})
66- echo "Changed files: $CHANGED_FILES"
67- if [[ $CHANGED_FILES == *".github/docker/"* ]]; then
68- echo "Build IS needed as .github/docker/ folder changed."
69- echo "build-needed=true" >> $GITHUB_OUTPUT
70- else
71- echo "Build is NOT needed as .github/docker/ folder did not change."
72- echo "build-needed=false" >> $GITHUB_OUTPUT
73- fi
74- elif [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
75- echo "Build is needed for schedule or workflow_dispatch or schedule."
76- echo "build-needed=true" >> $GITHUB_OUTPUT
77- else
78- echo "Unrecognized event: ${{ github.event_name }}. Failing the build."
79- exit 1
80- fi
81-
8239 # Build the amd64 natively on ubuntu-latest which is an x86_64 host
8340 build-image-amd64 :
84- needs : check-if-build-needed
85- if : needs.check-if-build-needed.outputs.build-needed == 'true'
8641 runs-on : ubuntu-latest
8742 steps :
8843
89- - name : Checkout
90- uses : actions/checkout@v4
91- with :
92- ref : ${{github.head_ref}}
93-
9444 - name : Build Images
9545 uses : ./.github/actions/build_container
9646 with :
@@ -103,11 +53,9 @@ jobs:
10353 # Cross compiling the image using buildx on an x86_64 host was tried but failed due to
10454 # issues with qemu and multiarch support in docker buildx.
10555 build-image-arm64 :
106- needs : check-if-build-needed
107- if : needs.check-if-build-needed.outputs.build-needed == 'true'
10856 runs-on : ["self-hosted", "lecore-prd-u2404-arm64-xlrg-od-ephem"]
10957 steps :
110- - name : Checkout
58+ - name : Checkout Dockerfile
11159 uses : actions/checkout@v4
11260 with :
11361 ref : ${{github.head_ref}}
0 commit comments