@@ -3,11 +3,12 @@ name: Build and archive WLAN Pi kernel package
33on :
44 push :
55 branches :
6- - 6.12-bookworm
6+ - 7.1-trixie
77 paths :
88 - ' patches/**'
99 - ' wlanpi_*_defconfig'
1010 - ' build-kernel*.sh'
11+ - ' .github/workflows/build-and-archive-kernel-package.yml'
1112 workflow_dispatch :
1213 inputs :
1314 build_target :
1920 - both
2021 - v8
2122 - 2712
23+ distro :
24+ description : ' Target Debian release'
25+ required : true
26+ default : ' trixie'
27+ type : choice
28+ options :
29+ - trixie
30+ - bookworm
31+ upload_to_packagecloud :
32+ description : ' Upload built packages to packagecloud wlanpi/dev'
33+ required : true
34+ default : true
35+ type : boolean
2236
2337jobs :
2438 build :
2539 runs-on : ubuntu-24.04-arm
2640
41+ environment : PACKAGECLOUD
42+
2743 env :
28- DISTRO : bookworm
29- VERSION_CODENAME : bookworm
30- KERNEL_TARGET_DISTRO : Debian
31- KERNEL_TARGET_VERSION : bookworm
44+ # DEBIAN_RELEASE drives package naming in build-kernel.sh
45+ DEBIAN_RELEASE : ${{ github.event.inputs.distro || 'trixie' }}
3246 # Set BUILD_TARGET from workflow input, default to 'both' for push events
3347 BUILD_TARGET : ${{ github.event.inputs.build_target || 'both' }}
3448
87101 exit 1
88102 fi
89103 fi
90-
104+
91105 if [[ "$BUILD_TARGET" == "2712" || "$BUILD_TARGET" == "both" ]]; then
92106 if [ -f wlanpi_2712_defconfig ]; then
93107 echo "✓ wlanpi_2712_defconfig found"
@@ -119,51 +133,78 @@ jobs:
119133 echo "Built packages:"
120134 find output -name '*.deb' -type f -exec basename {} \;
121135
136+ if [ -z "$(find output -maxdepth 1 -name '*.deb' -print -quit)" ]; then
137+ echo "ERROR: no .deb packages were produced"
138+ exit 1
139+ fi
140+
122141 # Step 10: Upload v8 kernel package
123142 - name : Upload v8 kernel package
124143 if : ${{ env.BUILD_TARGET == 'v8' || env.BUILD_TARGET == 'both' }}
125144 uses : actions/upload-artifact@v4
126145 with :
127- name : wlanpi-kernel-bookworm -v8
128- path : output/wlanpi-kernel-bookworm -v8_*.deb
146+ name : wlanpi-kernel-${{ env.DEBIAN_RELEASE }} -v8
147+ path : output/wlanpi-kernel-${{ env.DEBIAN_RELEASE }} -v8_*.deb
129148 if-no-files-found : warn
130149
131150 # Step 11: Upload v8 headers package
132151 - name : Upload v8 headers package
133152 if : ${{ env.BUILD_TARGET == 'v8' || env.BUILD_TARGET == 'both' }}
134153 uses : actions/upload-artifact@v4
135154 with :
136- name : wlanpi-kernel-headers-bookworm -v8
137- path : output/wlanpi-kernel-headers-bookworm -v8_*.deb
155+ name : wlanpi-kernel-headers-${{ env.DEBIAN_RELEASE }} -v8
156+ path : output/wlanpi-kernel-headers-${{ env.DEBIAN_RELEASE }} -v8_*.deb
138157 if-no-files-found : warn
139158
140159 # Step 12: Upload 2712 kernel package
141160 - name : Upload 2712 Kernel Package
142161 if : ${{ env.BUILD_TARGET == '2712' || env.BUILD_TARGET == 'both' }}
143162 uses : actions/upload-artifact@v4
144163 with :
145- name : wlanpi-kernel-bookworm -2712
146- path : output/wlanpi-kernel-bookworm -2712_*.deb
164+ name : wlanpi-kernel-${{ env.DEBIAN_RELEASE }} -2712
165+ path : output/wlanpi-kernel-${{ env.DEBIAN_RELEASE }} -2712_*.deb
147166 if-no-files-found : warn
148167
149168 # Step 13: Upload 2712 headers package
150169 - name : Upload 2712 headers package
151170 if : ${{ env.BUILD_TARGET == '2712' || env.BUILD_TARGET == 'both' }}
152171 uses : actions/upload-artifact@v4
153172 with :
154- name : wlanpi-kernel-headers-bookworm -2712
155- path : output/wlanpi-kernel-headers-bookworm -2712_*.deb
173+ name : wlanpi-kernel-headers-${{ env.DEBIAN_RELEASE }} -2712
174+ path : output/wlanpi-kernel-headers-${{ env.DEBIAN_RELEASE }} -2712_*.deb
156175 if-no-files-found : warn
157176
158177 # Step 14: Upload dual kernel package
159178 - name : Upload dual kernel package
160179 if : ${{ env.BUILD_TARGET == 'both' }}
161180 uses : actions/upload-artifact@v4
162181 with :
163- name : wlanpi-kernel-bookworm -dual
164- path : output/wlanpi-kernel-bookworm_ *.deb
182+ name : wlanpi-kernel-${{ env.DEBIAN_RELEASE }} -dual
183+ path : output/wlanpi-kernel-${{ env.DEBIAN_RELEASE }}_ *.deb
165184 if-no-files-found : warn
166185
186+ # Step 15: Upload packages to packagecloud wlanpi/dev debian/DEBIAN_RELEASE.
187+ # Uses the package_cloud CLI directly instead of an action so we can detect
188+ # upload errors: the CLI exits 0 even when a push fails (Thor bug), which
189+ # has produced green runs that uploaded nothing.
190+ - name : Upload packages to packagecloud debian/${{ env.DEBIAN_RELEASE }}
191+ if : ${{ (github.event_name == 'push' || github.event.inputs.upload_to_packagecloud == 'true') && (github.repository_owner == 'WLAN-Pi') }}
192+ env :
193+ PACKAGECLOUD_TOKEN : ${{ secrets.PACKAGECLOUD_TOKEN }}
194+ run : |
195+ sudo gem install package_cloud
196+ status=0
197+ for deb in output/*.deb; do
198+ echo "Pushing ${deb} to wlanpi/dev/debian/${DEBIAN_RELEASE}"
199+ out=$(package_cloud push "wlanpi/dev/debian/${DEBIAN_RELEASE}" "$deb" 2>&1) || status=1
200+ echo "$out"
201+ if ! echo "$out" | grep -q "success!"; then
202+ echo "::error::Upload of ${deb} to debian/${DEBIAN_RELEASE} did not report success"
203+ status=1
204+ fi
205+ done
206+ exit $status
207+
167208 slack-workflow-status :
168209 if : ${{ always() && (github.repository_owner == 'WLAN-Pi') && (! github.event.pull_request.head.repo.fork) }}
169210 name : Post Workflow Status to Slack
0 commit comments