Flatpak is not buildable in docker

This commit is contained in:
XargonWan 2024-11-05 21:30:39 +09:00
parent 18fce17419
commit 8da47e1144
2 changed files with 42 additions and 12 deletions

View file

@ -26,6 +26,9 @@ jobs:
steps: steps:
- name: Prepearing environment
run: curl -s "https://raw.githubusercontent.com/RetroDECK/components-template/refs/heads/main/automation_tools/install_dependencies.sh" | /bin/bash
- name: Generate a token for Rekku - name: Generate a token for Rekku
if: ${{ github.repository == 'RetroDECK/RetroDECK' }} if: ${{ github.repository == 'RetroDECK/RetroDECK' }}
id: generate-rekku-token id: generate-rekku-token
@ -63,21 +66,15 @@ jobs:
- name: "Build flatpak" - name: "Build flatpak"
run: | run: |
# Pull the Docker image
docker pull ebassi/flathub:base
# Configure Git # Configure Git
git config --global protocol.file.allow always git config --global protocol.file.allow always
# Run the flatpak build inside the Docker container flatpak-builder --user --force-clean \
docker run --rm \ --install-deps-from=flathub \
-v "${GITHUB_WORKSPACE}:/workspace" \ --install-deps-from=flathub-beta \
-w /workspace \ --repo=${GITHUB_WORKSPACE}/artifacts-repo \
ghcr.io/retrodeck/retrodeck-builder:latest \ "${GITHUB_WORKSPACE}/artifacts-build-dir" \
--force-clean \ net.retrodeck.retrodeck.yml
--repo="/workspace/artifacts-repo" \
"/workspace/artifacts-build-dir" \
"${{ inputs.MANIFEST_FILENAME }}"
- name: "Exporting dir tree" - name: "Exporting dir tree"
id: tree id: tree

View file

@ -0,0 +1,33 @@
#!/bin/bash
# This script is installing the required dependencies to correctly run the pipeline and build the flatpak
unset pkg_mgr
# rpm-ostree must be checked before dnf because a dnf (wrapper) command also works on rpm-ostree distros (not what we want)
for potential_pkg_mgr in apt pacman rpm-ostree dnf; do
command -v "$potential_pkg_mgr" &> /dev/null && pkg_mgr="$potential_pkg_mgr" && break
done
case "$pkg_mgr" in
apt)
sudo add-apt-repository -y ppa:flatpak/stable
sudo apt update
sudo apt install -y flatpak flatpak-builder p7zip-full xmlstarlet bzip2 curl jq
;;
pacman)
sudo pacman -Syu --noconfirm flatpak flatpak-builder p7zip xmlstarlet bzip2
;;
rpm-ostree)
echo "When using a distro with rpm-ostree, you shouldn't build directly on the host. Try using a distrobox."
exit 1
;;
dnf)
sudo dnf install -y flatpak flatpak-builder p7zip p7zip-plugins xmlstarlet bzip2 curl
;;
*)
echo "Package manager $pkg_mgr not supported. Please open an issue."
;;
esac
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo