From dac63e0ecbce0a3af230de331252f3bbff95af7a Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 22 Sep 2023 14:47:25 +0200 Subject: [PATCH] CI: Integrate changes from linuxmotehook2 (#14) --- .github/workflows/appimage.yml | 27 ++++++++++++++------------- Dockerfile | 12 ++++++++---- dist/AppImageBuilder.yml | 4 +++- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 9bef9ab..b95c537 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -5,9 +5,11 @@ env: UBUNTU_PUBKEY: 871920D1991BC93C on: - push: - branches: [ "main" ] pull_request: + push: + branches: main + release: + types: published jobs: build: @@ -44,17 +46,16 @@ jobs: TARGET_PLATFORM: ${{ matrix.platform }} shell: bash run: | - set -eu - find build -mindepth 1 -maxdepth 1 -type d | while read -r path; do - set -a - APPIMAGE_SOURCE="${path}" - APPIMAGE_VERSION="${GITHUB_REF_SLUG}" - APPIMAGE_APT_ARCH="${TARGET_PLATFORM#*/}" - APPIMAGE_APT_DISTRO="${UBUNTU_RELEASE}" - APPIMAGE_APT_PUBKEY="${UBUNTU_PUBKEY}" - APPIMAGE_ARCH="$(basename "${path}")" - printenv | grep ^APPIMAGE_ >>"${GITHUB_ENV}" - done + set -eua + . build/.build-metadata.env + rm build/.build-metadata.env + APPIMAGE_SOURCE=build + APPIMAGE_VERSION="${GITHUB_REF_SLUG}" + APPIMAGE_APT_ARCH="${TARGETARCH}" + APPIMAGE_APT_DISTRO="${UBUNTU_RELEASE}" + APPIMAGE_APT_PUBKEY="${UBUNTU_PUBKEY}" + APPIMAGE_ARCH="${TARGETMACHINE}" + printenv | grep ^APPIMAGE_ >>"${GITHUB_ENV}" - name: Build AppImage uses: AppImageCrafters/build-appimage@v1.3 diff --git a/Dockerfile b/Dockerfile index d7bf7da..ed3cfdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,15 +8,19 @@ COPY . / ARG BUILD_TYPE=release ARG ENABLE_LTO=true +ARG TARGETOS TARGETARCH TARGETVARIANT RUN meson setup \ + --fatal-meson-warnings \ "--buildtype=${BUILD_TYPE}" \ "-Db_lto=${ENABLE_LTO}" \ - "--prefix=/usr" \ + --prefix=/usr \ /build && \ meson compile -C /build && \ - meson install --destdir="/release/$(uname -m)" -C /build + meson install --destdir=/release -C /build -FROM scratch AS export-stage +RUN export "TARGETMACHINE=$(uname -m)" && \ + printenv | grep ^TARGET >>/release/.build-metadata.env -COPY --from=build-stage /release/ / +FROM scratch AS export-stage +COPY --from=build-stage /release/ /release/.build-metadata.env / diff --git a/dist/AppImageBuilder.yml b/dist/AppImageBuilder.yml index 57aacb6..c29be17 100644 --- a/dist/AppImageBuilder.yml +++ b/dist/AppImageBuilder.yml @@ -7,7 +7,9 @@ script: mkdir -p "${icon_path}" cp -a dist/evdevhook2.png "${icon_path}" # Manual installation is required until fix of https://github.com/AppImageCrafters/build-appimage/issues/5 - apt-get update && apt-get install -y --no-install-recommends squashfs-tools + if ! command -v mksquashfs >/dev/null; then + apt-get update && apt-get install -y --no-install-recommends squashfs-tools + fi AppDir: app_info: