Skip to content

Commit 45ded3e

Browse files
committed
.github/workflows: Add support for Fedora 42
1 parent 3a3f149 commit 45ded3e

File tree

1 file changed

+105
-1
lines changed

1 file changed

+105
-1
lines changed

.github/workflows/ci.yml

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,56 @@ jobs:
224224
name: fedora-41-latest
225225
path: pkg/fedora/out/x86_64
226226

227+
build-f42:
228+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
229+
230+
name: Build Fedora 42 package
231+
runs-on: ubuntu-latest
232+
needs: [lint, test]
233+
container:
234+
image: registry.fedoraproject.org/fedora:42
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-42-latest
270+
path: pkg/fedora/out/x86_64
271+
227272
release:
228273
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
229274

230275
name: Publish release
231-
needs: [build-bin, build-deb, build-f40, build-f41]
276+
needs: [build-bin, build-deb, build-f40, build-f41, build-f42]
232277
runs-on: ubuntu-latest
233278

234279
steps:
@@ -256,6 +301,12 @@ jobs:
256301
name: fedora-41-latest
257302
path: fedora-41-latest
258303

304+
- name: Download Fedora 42 artifacts
305+
uses: actions/download-artifact@v4
306+
with:
307+
name: fedora-42-latest
308+
path: fedora-42-latest
309+
259310
- name: Upload assets
260311
uses: svenstaro/upload-release-action@v2
261312
with:
@@ -422,3 +473,56 @@ jobs:
422473
git add .
423474
git commit -m "Update Fedora 41 surface-control"
424475
git push --set-upstream origin "${update_branch}"
476+
477+
repo-f42:
478+
name: Update Fedora 42 package repository
479+
needs: [release]
480+
runs-on: ubuntu-latest
481+
container:
482+
image: registry.fedoraproject.org/fedora:42
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-42-latest
493+
path: fedora-42-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-42-latest/* repo/fedora/f42
508+
cd repo/fedora/f42
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 42 surface-control"
528+
git push --set-upstream origin "${update_branch}"

0 commit comments

Comments
 (0)