diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..04f3214 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.github +Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..09f3b4a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Build and publish AppImages + +env: + UBUNTU_RELEASE: jammy + UBUNTU_PUBKEY: 871920D1991BC93C + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + platform: + - linux/amd64 + - linux/arm64 + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v2 + if: matrix.platform != 'linux/amd64' + - uses: docker/setup-buildx-action@v2 + - uses: docker/build-push-action@v4 + with: + platforms: ${{ matrix.platform }} + outputs: build + build-args: | + UBUNTU_RELEASE + - uses: rlespinasse/github-slug-action@v4 + - name: Prepare AppImage build + env: + 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_PATH="${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 + - uses: AppImageCrafters/build-appimage@v1 + with: + recipe: dist/AppImageBuilder.yml + - uses: actions/upload-artifact@v3 + with: + name: appimages + path: ./*.AppImage* + if-no-files-found: error + + release: + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: + - build + permissions: + contents: write + steps: + - uses: actions/download-artifact@v3 + with: + name: appimages + path: assets + - name: Create checksum for release assets + shell: bash + run: | + algo="${SHA_ALGORITHM:-256}" + find assets -type f | while read -r asset; do + shasum --binary --algorithm "${algo}" "${asset}" >"${asset}.sha${algo}" + done + - uses: softprops/action-gh-release@v1 + with: + files: assets/* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1433d23 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +ARG UBUNTU_RELEASE=jammy + +FROM ubuntu:$UBUNTU_RELEASE AS build-stage +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + git ca-certificates build-essential libudev-dev libevdev-dev zlib1g-dev valac libgee-0.8-dev meson +COPY . / +ARG BUILD_TYPE=release +ARG ENABLE_LTO=true +RUN meson setup \ + "--fatal-meson-warnings" \ + "--buildtype=${BUILD_TYPE}" \ + "-Db_lto=${ENABLE_LTO}" \ + "--prefix=/usr" \ + /build && \ + meson compile -C /build && \ + meson install "--destdir=/release/$(uname -m)" -C /build + +FROM scratch AS export-stage +COPY --from=build-stage /release/ / diff --git a/dist/AppImageBuilder.yml b/dist/AppImageBuilder.yml new file mode 100644 index 0000000..653509a --- /dev/null +++ b/dist/AppImageBuilder.yml @@ -0,0 +1,49 @@ +version: 1 + +script: +- | + icon_path="{{APPIMAGE_PATH}}/usr/share/icons/hicolor/128x128/apps" + mkdir -p "${icon_path}" + cp -a dist/evdevhook2.png "${icon_path}" + +AppDir: + path: "{{APPIMAGE_PATH}}" + + app_info: + id: org.v1993.evdevhook2 + name: evdevhook2 + version: "{{APPIMAGE_VERSION}}" + icon: evdevhook2 + exec: usr/bin/evdevhook2 + exec_args: $@ + + apt: + arch: + - "{{APPIMAGE_APT_ARCH}}" + sources: + - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ "{{APPIMAGE_APT_DISTRO}}" main + key_url: "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}}" + - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ "{{APPIMAGE_APT_DISTRO}}"-updates main + - sourceline: deb [arch=amd64] http://security.ubuntu.com/ubuntu/ "{{APPIMAGE_APT_DISTRO}}"-security main + - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ "{{APPIMAGE_APT_DISTRO}}" main + - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ "{{APPIMAGE_APT_DISTRO}}"-updates main + - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ "{{APPIMAGE_APT_DISTRO}}"-security main + include: + - libudev1 + - libevdev2 + - libglib2.0-0 + - libgee-0.8-2 + + files: + exclude: + - usr/share/man + - usr/share/doc/*/README.* + - usr/share/doc/*/changelog.* + - usr/share/doc/*/NEWS.* + - usr/share/doc/*/TODO.* + - usr/share/lintian + - usr/lib/*/glib-2.0 + +AppImage: + arch: "{{APPIMAGE_ARCH}}" + update-information: "gh-releases-zsync|v1993|evdevhook2|latest|evdevhook2-*-{{APPIMAGE_ARCH}}.AppImage.zsync" diff --git a/dist/evdevhook2.png b/dist/evdevhook2.png new file mode 100644 index 0000000..b37ee33 Binary files /dev/null and b/dist/evdevhook2.png differ