Skip to content

Commit abda7a7

Browse files
committed
.github/workflows: Update actions
1 parent 6b46765 commit abda7a7

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
@@ -168,11 +168,101 @@ jobs:
168168
name: fedora-39-latest
169169
path: pkg/fedora/out/x86_64
170170

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

174264
name: Publish release
175-
needs: [build-bin, build-deb, build-f39]
265+
needs: [build-bin, build-deb, build-f39, build-f40, build-f41]
176266
runs-on: ubuntu-latest
177267

178268
steps:
@@ -194,6 +284,18 @@ jobs:
194284
name: fedora-39-latest
195285
path: fedora-39-latest
196286

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

0 commit comments

Comments
 (0)