Skip to content

Commit 5276c1c

Browse files
committed
.github/workflows: Add support for Fedora 40 and 41
1 parent e5133a1 commit 5276c1c

File tree

1 file changed

+209
-1
lines changed

1 file changed

+209
-1
lines changed

.github/workflows/ci.yml

Lines changed: 209 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,101 @@ jobs:
179179
name: fedora-39-latest
180180
path: pkg/fedora/out/x86_64
181181

182+
build-f40:
183+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
184+
185+
name: Build Fedora 40 package
186+
runs-on: ubuntu-latest
187+
needs: [lint, test]
188+
container:
189+
image: registry.fedoraproject.org/fedora:40
190+
options: --security-opt seccomp=unconfined
191+
192+
steps:
193+
- name: Checkout code
194+
uses: actions/checkout@v4
195+
196+
- name: Install build dependencies
197+
run: |
198+
dnf distro-sync -y
199+
dnf install -y rpmdevtools rpm-sign 'dnf-command(builddep)'
200+
dnf builddep -y pkg/fedora/surface-control.spec
201+
202+
- name: Build package
203+
run: |
204+
cd pkg/fedora
205+
# Build the .rpm packages
206+
./makerpm
207+
208+
- name: Sign packages
209+
env:
210+
GPG_KEY_ID: 56C464BAAC421453
211+
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
212+
run: |
213+
cd pkg/fedora/out/x86_64
214+
215+
# import GPG key
216+
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
217+
218+
# sign package
219+
rpm --resign *.rpm --define "_gpg_name $GPG_KEY_ID"
220+
221+
- name: Upload artifacts
222+
uses: actions/upload-artifact@v4
223+
with:
224+
name: fedora-40-latest
225+
path: pkg/fedora/out/x86_64
226+
227+
build-f41:
228+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
229+
230+
name: Build Fedora 41 package
231+
runs-on: ubuntu-latest
232+
needs: [lint, test]
233+
container:
234+
image: registry.fedoraproject.org/fedora:41
235+
options: --security-opt seccomp=unconfined
236+
237+
steps:
238+
- name: Checkout code
239+
uses: actions/checkout@v4
240+
241+
- name: Install build dependencies
242+
run: |
243+
dnf distro-sync -y
244+
dnf install -y rpmdevtools rpm-sign 'dnf-command(builddep)'
245+
dnf builddep -y pkg/fedora/surface-control.spec
246+
247+
- name: Build package
248+
run: |
249+
cd pkg/fedora
250+
# Build the .rpm packages
251+
./makerpm
252+
253+
- name: Sign packages
254+
env:
255+
GPG_KEY_ID: 56C464BAAC421453
256+
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
257+
run: |
258+
cd pkg/fedora/out/x86_64
259+
260+
# import GPG key
261+
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
262+
263+
# sign package
264+
rpm --resign *.rpm --define "_gpg_name $GPG_KEY_ID"
265+
266+
- name: Upload artifacts
267+
uses: actions/upload-artifact@v4
268+
with:
269+
name: fedora-41-latest
270+
path: pkg/fedora/out/x86_64
271+
182272
release:
183273
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
184274

185275
name: Publish release
186-
needs: [build-bin, build-deb, build-f39]
276+
needs: [build-bin, build-deb, build-f39, build-f40, build-f41]
187277
runs-on: ubuntu-latest
188278

189279
steps:
@@ -205,6 +295,18 @@ jobs:
205295
name: fedora-39-latest
206296
path: fedora-39-latest
207297

298+
- name: Download Fedora 40 artifacts
299+
uses: actions/download-artifact@v4
300+
with:
301+
name: fedora-40-latest
302+
path: fedora-40-latest
303+
304+
- name: Download Fedora 41 artifacts
305+
uses: actions/download-artifact@v4
306+
with:
307+
name: fedora-41-latest
308+
path: fedora-41-latest
309+
208310
- name: Upload assets
209311
uses: svenstaro/upload-release-action@v2
210312
with:
@@ -318,3 +420,109 @@ jobs:
318420
git add .
319421
git commit -m "Update Fedora 39 surface-control"
320422
git push --set-upstream origin "${update_branch}"
423+
424+
repo-f40:
425+
name: Update Fedora 40 package repository
426+
needs: [release]
427+
runs-on: ubuntu-latest
428+
container:
429+
image: registry.fedoraproject.org/fedora:40
430+
options: --security-opt seccomp=unconfined
431+
steps:
432+
- name: Install dependencies
433+
run: |
434+
dnf install -y git findutils
435+
436+
- name: Download artifacts
437+
uses: actions/download-artifact@v4
438+
with:
439+
name: fedora-40-latest
440+
path: fedora-40-latest
441+
442+
- name: Update repository
443+
env:
444+
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
445+
BRANCH_STAGING: u/staging
446+
GIT_REF: ${{ github.ref }}
447+
run: |
448+
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
449+
450+
# clone package repository
451+
git clone -b "${BRANCH_STAGING}" "${repo}" repo
452+
453+
# copy packages
454+
cp fedora-40-latest/* repo/fedora/f40
455+
cd repo/fedora/f40
456+
457+
# parse git tag from ref
458+
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
459+
460+
# convert packages into references
461+
for pkg in $(find . -name '*.rpm'); do
462+
echo "surface-control:$GIT_TAG/$(basename $pkg)" > $pkg.blob
463+
rm $pkg
464+
done
465+
466+
# set git identity
467+
git config --global user.email "[email protected]"
468+
git config --global user.name "surfacebot"
469+
470+
# commit and push
471+
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
472+
git checkout -b "${update_branch}"
473+
git add .
474+
git commit -m "Update Fedora 40 surface-control"
475+
git push --set-upstream origin "${update_branch}"
476+
477+
repo-f41:
478+
name: Update Fedora 41 package repository
479+
needs: [release]
480+
runs-on: ubuntu-latest
481+
container:
482+
image: registry.fedoraproject.org/fedora:41
483+
options: --security-opt seccomp=unconfined
484+
steps:
485+
- name: Install dependencies
486+
run: |
487+
dnf install -y git findutils
488+
489+
- name: Download artifacts
490+
uses: actions/download-artifact@v4
491+
with:
492+
name: fedora-41-latest
493+
path: fedora-41-latest
494+
495+
- name: Update repository
496+
env:
497+
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
498+
BRANCH_STAGING: u/staging
499+
GIT_REF: ${{ github.ref }}
500+
run: |
501+
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
502+
503+
# clone package repository
504+
git clone -b "${BRANCH_STAGING}" "${repo}" repo
505+
506+
# copy packages
507+
cp fedora-41-latest/* repo/fedora/f41
508+
cd repo/fedora/f41
509+
510+
# parse git tag from ref
511+
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
512+
513+
# convert packages into references
514+
for pkg in $(find . -name '*.rpm'); do
515+
echo "surface-control:$GIT_TAG/$(basename $pkg)" > $pkg.blob
516+
rm $pkg
517+
done
518+
519+
# set git identity
520+
git config --global user.email "[email protected]"
521+
git config --global user.name "surfacebot"
522+
523+
# commit and push
524+
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
525+
git checkout -b "${update_branch}"
526+
git add .
527+
git commit -m "Update Fedora 41 surface-control"
528+
git push --set-upstream origin "${update_branch}"

0 commit comments

Comments
 (0)