Skip to content

Truly independent web browser

CI+Meta: Build the Flatpak in the Build Release workflow

Jelle Raaijmakers41418e2ef5e2
diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
index 8a7f565199a..1bec9550e51 100644
--- a/.github/workflows/build-release.yml
+++ b/.github/workflows/build-release.yml
@@ -67,3 +67,83 @@ jobs:
path: Build/packages/*.tar.zst
compression-level: 0
if-no-files-found: error
+
+ Flatpak:
+ if: github.repository == 'LadybirdBrowser/ladybird'
+ name: Flatpak, ${{ matrix.arch }}
+ runs-on: ${{ fromJSON(matrix.runner_labels) }}
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - arch: 'x86_64'
+ runner_labels: '["blacksmith-16vcpu-ubuntu-2404"]'
+ - arch: 'aarch64'
+ runner_labels: '["blacksmith-16vcpu-ubuntu-2404-arm"]'
+
+ container:
+ image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.10
+ options: --privileged
+
+ permissions:
+ contents: read
+ id-token: write
+ attestations: write
+ artifact-metadata: write
+
+ env:
+ BUNDLE: ladybird-${{ inputs.version }}-Linux-${{ matrix.arch }}.flatpak
+
+ steps:
+ - uses: actions/[email protected]
+
+ # The image bakes the SDK into a read-only layer, and the action always has flatpak-builder update it from
+ # Flathub. An update renames the old deployment into /var/lib/flatpak/.removed, and overlayfs can't rename a
+ # directory that lives in a lower layer (EXDEV), so whenever Flathub carries a newer SDK than the image, the
+ # build dies before compiling anything. Copying the installation up into the writable layer first (about 5 GB,
+ # some 15 seconds) makes that rename an ordinary one, whatever Flathub has published since the image was built.
+ - name: Make the baked-in Flatpak installation writable
+ run: |
+ cp -a /var/lib/flatpak /var/lib/flatpak.rw
+ rm -rf /var/lib/flatpak
+ mv /var/lib/flatpak.rw /var/lib/flatpak
+
+ - name: Set the version in the manifest
+ env:
+ RELEASE_VERSION: ${{ inputs.version }}
+ run: |
+ python3 - <<'SCRIPT'
+ import json
+ import os
+
+ path = "Meta/CMake/flatpak/org.ladybird.Ladybird.json"
+ with open(path) as file:
+ manifest = json.load(file)
+ ladybird = next(module for module in manifest["modules"] if module["name"] == "Ladybird")
+ ladybird["config-opts"].append(f"-DLADYBIRD_VERSION={os.environ['RELEASE_VERSION']}")
+ with open(path, "w") as file:
+ json.dump(manifest, file, indent=4)
+ SCRIPT
+
+ - name: Build
+ uses: flatpak/flatpak-github-actions/flatpak-builder@v6
+ with:
+ bundle: ${{ env.BUNDLE }}
+ manifest-path: Meta/CMake/flatpak/org.ladybird.Ladybird.json
+ arch: ${{ matrix.arch }}
+ save-cache: false
+ upload-artifact: false
+
+ - name: Attest
+ uses: actions/attest@v4
+ with:
+ subject-path: ${{ env.BUNDLE }}
+
+ - name: Upload
+ uses: actions/upload-artifact@v7
+ with:
+ name: ladybird-Flatpak-${{ matrix.arch }}
+ path: ${{ env.BUNDLE }}
+ compression-level: 0
+ if-no-files-found: error
diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml
deleted file mode 100644
index e70d0450fa5..00000000000
--- a/.github/workflows/flatpak.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: Flatpak
-
-on:
- push:
- branches: [master]
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
- cancel-in-progress: true
-
-jobs:
- Flatpak:
- if: github.repository == 'LadybirdBrowser/ladybird'
- name: Flatpak ${{ matrix.arch }}
-
- strategy:
- fail-fast: false
- matrix:
- arch: ['x86_64']
- runner_labels: ['["blacksmith-16vcpu-ubuntu-2404"]']
-
- include:
- - arch: 'aarch64'
- runner_labels: '["blacksmith-16vcpu-ubuntu-2404-arm"]'
-
- secrets: inherit
- uses: ./.github/workflows/flatpak-template.yml
- with:
- arch: ${{ matrix.arch }}
- runner_labels: ${{ matrix.runner_labels }}
diff --git a/Meta/CMake/freedesktop/org.ladybird.Ladybird.metainfo.xml.in b/Meta/CMake/freedesktop/org.ladybird.Ladybird.metainfo.xml.in
index 3aafc83edb0..1e135948aab 100644
--- a/Meta/CMake/freedesktop/org.ladybird.Ladybird.metainfo.xml.in
+++ b/Meta/CMake/freedesktop/org.ladybird.Ladybird.metainfo.xml.in
@@ -39,10 +39,10 @@
<launchable type="desktop-id">org.ladybird.Ladybird.desktop</launchable>
<releases>
- <release version="@CMAKE_PROJECT_VERSION@-snapshot-@GIT_HASH@" type="snapshot" date="@DATE@">
+ <release version="@METAINFO_RELEASE_VERSION@" type="@METAINFO_RELEASE_TYPE@" date="@DATE@">
<description>
<p>
- Pre-Alpha.
+ @METAINFO_RELEASE_DESCRIPTION@
</p>
</description>
</release>
diff --git a/UI/cmake/InstallRules.cmake b/UI/cmake/InstallRules.cmake
index 9335c0dd1b4..c783814f22f 100644
--- a/UI/cmake/InstallRules.cmake
+++ b/UI/cmake/InstallRules.cmake
@@ -172,6 +172,23 @@ if (ENABLE_INSTALL_FREEDESKTOP_FILES)
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
+ if (LADYBIRD_VERSION STREQUAL "")
+ set(METAINFO_RELEASE_VERSION "${CMAKE_PROJECT_VERSION}-snapshot-${GIT_HASH}")
+ set(METAINFO_RELEASE_TYPE "snapshot")
+ set(METAINFO_RELEASE_DESCRIPTION "Development snapshot.")
+ elseif (LADYBIRD_VERSION MATCHES "\\.alpha$")
+ set(METAINFO_RELEASE_VERSION "${LADYBIRD_VERSION}")
+ set(METAINFO_RELEASE_TYPE "development")
+ set(METAINFO_RELEASE_DESCRIPTION "Alpha release.")
+ elseif (LADYBIRD_VERSION MATCHES "\\.beta$")
+ set(METAINFO_RELEASE_VERSION "${LADYBIRD_VERSION}")
+ set(METAINFO_RELEASE_TYPE "development")
+ set(METAINFO_RELEASE_DESCRIPTION "Beta release.")
+ else()
+ set(METAINFO_RELEASE_VERSION "${LADYBIRD_VERSION}")
+ set(METAINFO_RELEASE_TYPE "stable")
+ set(METAINFO_RELEASE_DESCRIPTION "Stable release.")
+ endif()
configure_file("${FREEDESKTOP_RESOURCE_DIR}/org.ladybird.Ladybird.metainfo.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/org.ladybird.Ladybird.metainfo.xml" @ONLY)
install(FILES
"${FREEDESKTOP_RESOURCE_DIR}/org.ladybird.Ladybird.svg"