1- name : eve- kernel build
1+ name : Building and pushing Eve kernel images
22
33on :
4- workflow_dispatch :
5- inputs :
6- ref :
7- description : " Branch or tag to build"
8- required : false
9- pull_request_target :
10- branches :
11- - " eve-kernel-next"
12- - " eve-kernel-*-v[0-9]+.[0-9]+.[0-9]+-*"
134 push :
145 branches :
15- - " eve-kernel-amd64-v6.1.112-generic"
16-
17- env :
18- BASE_REF : " eve-kernel-amd64-v6.1.112-generic" # no refs/heads/ prefix
6+ - " gha-test-rebase"
197
208concurrency :
21- group : ${{ github.workflow }}-${{ github.event_name }}-${{
22- github.event.pull_request.number ||
23- (github.event_name == 'push' && github.ref) ||
24- github.ref_name
25- }}
9+ group : main-build-${{ github.ref }}
2610 cancel-in-progress : true
2711
2812jobs :
@@ -35,86 +19,35 @@ jobs:
3519
3620 runs-on : [runner-xl, X64, Linux]
3721
38- if : >
39- github.event_name == 'workflow_dispatch' ||
40- github.event_name == 'push' ||
41- github.event_name == 'pull_request_target'
42-
4322 steps :
44- - name : Debug GitHub refs
45- run : |
46- echo "event_name: ${{ github.event_name }}"
47- echo "github.ref: ${{ github.ref }}"
48- echo "github.ref_name: ${{ github.ref_name }}"
49- echo "github.head_ref: ${{ github.head_ref }}"
50- echo "event.inputs.ref: ${{ github.event.inputs.ref }}"
51- echo "event.repository.full_name: ${{ github.event.pull_request.head.repo.full_name }}"
52- echo "github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}"
53- echo "github.event.pull_request.head.sha: ${{ github.event.pull_request.head.sha }}"
54-
55- - name : Set checkout reference
56- id : set-ref
57- run : |
58- if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.ref }}" ]]; then
59- REF="${{ github.event.inputs.ref }}"
60- # Normalize input to full ref
61- if [[ "$REF" != refs/* ]]; then
62- REF="refs/heads/$REF"
63- fi
64- elif [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
65- # Use GitHub's generated merge ref for PRs
66- REF="${{ github.event.pull_request.head.sha }}"
67- else
68- REF="${{ github.ref }}"
69- fi
70-
71- echo "Using ref: $REF"
72- echo "ref_to_use=$REF" >> $GITHUB_OUTPUT
73-
74- - name : Set BRANCH variable
75- run : |
76- if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
77- BR="${{ github.event.pull_request.head.ref }}"
78- else
79- BR="${{ github.ref_name }}"
80- fi
81- # Sanitize for Docker tag: replace slashes with dashes
82- SAFE_BRANCH="${BR//\//-}"
83- echo "BRANCH=$SAFE_BRANCH" >> $GITHUB_ENV
84- shell : bash
85-
8623 - name : Checkout code
8724 uses : actions/checkout@v4
8825 with :
89- ref : ${{ steps.set-ref.outputs.ref_to_use }}
90- repository : ${{ github.event.pull_request.head.repo.full_name }}
26+ ref : ${{ github.ref }}
9127 fetch-depth : 1
9228
93- - name : Login to Docker Hub
94- if : ${{ github.event.repository.full_name }}== 'lf-edge/eve-kernel'
29+ - name : Login to Docker Hub (pull)
9530 uses : docker/login-action@v3
9631 with :
9732 username : ${{ secrets.DOCKERHUB_PULL_USER }}
9833 password : ${{ secrets.DOCKERHUB_PULL_TOKEN }}
9934
100- - name : Build kernel flavor ${{ matrix.flavor }}
35+ - name : Build kernel flavor ${{ matrix.flavor }} from ${{ github.ref_name }}
10136 run : |
10237 make -f Makefile.eve \
10338 KERNEL_CONFIG_FLAVOR=${{ matrix.flavor }} \
104- BRANCH=$BRANCH \
39+ BRANCH=${{ github.ref_name }} \
10540 kernel-gcc
10641
107- - name : Log in to Docker Hub
108- if : github.ref == format('refs/heads/{0}', env.BASE_REF)
42+ - name : Login to Docker Hub (push)
10943 uses : docker/login-action@v3
11044 with :
11145 username : ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }}
11246 password : ${{ secrets.RELEASE_DOCKERHUB_TOKEN }}
11347
114- - name : Push ${{ matrix.flavor }} image
115- if : github.ref == format('refs/heads/{0}', env.BASE_REF)
48+ - name : Push ${{ matrix.flavor }} from ${{ github.ref_name }}
11649 run : |
11750 make -f Makefile.eve \
11851 KERNEL_CONFIG_FLAVOR=${{ matrix.flavor }} \
119- BRANCH=$BRANCH \
52+ BRANCH=${{ github.ref_name }} \
12053 push-gcc
0 commit comments