From 9a27c8b9dd39ed74ea50685186cefee422d8c3e0 Mon Sep 17 00:00:00 2001 From: Sam Webster Date: Sun, 18 May 2025 14:15:10 +1000 Subject: [PATCH 1/3] attempt to fix for non-debian distros --- .github/workflows/linux-appimage-test.yaml | 121 +++++++++++++++++++++ build/linux/linuxdeploy-plugin-gtk.sh | 23 +++- 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/linux-appimage-test.yaml diff --git a/.github/workflows/linux-appimage-test.yaml b/.github/workflows/linux-appimage-test.yaml new file mode 100644 index 0000000..61a0e65 --- /dev/null +++ b/.github/workflows/linux-appimage-test.yaml @@ -0,0 +1,121 @@ +name: Release MQTT Viewer - Linux + +on: + push: + tags: + - "*" + +jobs: + release: + strategy: + matrix: + build: + - arch: amd64 + platform: linux/amd64 + os: blacksmith + tag: linux_amd64 + - arch: arm64 + platform: linux/arm64 + os: blacksmith-arm + tag: linux_arm64 + runs-on: ${{ matrix.build.os }} + name: Release MQTT Viewer (${{ matrix.build.tag }}) + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + # Set up common, sanitised environment variables + + - name: Normalise version tag + id: normalise_version + shell: bash + run: | + echo "version=v0.6.5" >> $GITHUB_OUTPUT + + - name: Define output filename + id: define_filename + shell: bash + run: | + echo "filename=MQTT_Viewer_${{ steps.normalise_version.outputs.version }}_${{ matrix.build.tag }}" >> $GITHUB_OUTPUT + + # Set up development dependencies + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.23.3" + + - name: Install wails + shell: bash + run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.9.1 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: "20.15.0" + + # Dependencies + + - name: Install Ubuntu prerequisites + shell: bash + run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev + + # Build + + - name: Build frontend assets + shell: bash + run: | + npm install -g pnpm + cd frontend && pnpm install + + - name: Build wails app for AppImage + shell: bash + run: | + LD_FLAGS="-X mqtt-viewer/backend/env.Version=${{ steps.normalise_version.outputs.version }}" + LD_FLAGS="${LD_FLAGS} -X mqtt-viewer/backend/env.MachineIdProtectString=${{ secrets.MACHINE_ID_SECRET }}" + LD_FLAGS="${LD_FLAGS} -X mqtt-viewer/backend/env.CloudUsername=${{ secrets.CLOUD_USERNAME }}" + LD_FLAGS="${LD_FLAGS} -X mqtt-viewer/backend/env.CloudPassword=${{ secrets.CLOUD_PASSWORD }}" + LD_FLAGS="${LD_FLAGS} -X mqtt-viewer/backend/env.IsAppImage=true" + wails build -platform ${{ matrix.build.platform }} -ldflags "${LD_FLAGS}" -tags webkit2_41 + + # Rename + + - name: Rename linux binary to be appimage compatible + shell: bash + run: | + cd build/bin && mv "MQTT Viewer" MQTTViewer + + # Package AppImage + - name: Package app image + shell: bash + run: | + cd build/linux && go run build_appimage.go + + # Rename + - name: Rename app image + shell: bash + run: | + cd build/linux && mv MQTTViewer*.AppImage ${{ steps.define_filename.outputs.filename }}.AppImage + + # ls to check it worked + - name: List files + shell: bash + run: | + ls -la build/linux + + #Publish + # - name: Upload release appimage + # uses: alexellis/upload-assets@0.4.1 + # env: + # GITHUB_TOKEN: ${{ github.token }} + # with: + # asset_paths: '[]' + + # Publish to existing release + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/linux/${{ steps.define_filename.outputs.filename }}.AppImage + tag: v0.6.5 + overwrite: false diff --git a/build/linux/linuxdeploy-plugin-gtk.sh b/build/linux/linuxdeploy-plugin-gtk.sh index 51c1231..2344ec4 100755 --- a/build/linux/linuxdeploy-plugin-gtk.sh +++ b/build/linux/linuxdeploy-plugin-gtk.sh @@ -113,6 +113,7 @@ search_tool() { PATH_ARRAY=( "$(get_triplet_path)/$directory/$tool" + "/usr/lib/$(uname -m)-linux-gnu/$directory/$tool" "/usr/lib64/$directory/$tool" "/usr/lib/$directory/$tool" "/usr/bin/$tool" @@ -163,6 +164,9 @@ fi APPDIR="$(realpath "$APPDIR")" mkdir -p "$APPDIR" +# make lib64 writable again. -- added from tauri script +chmod +w "$APPDIR"/usr/lib64 || true + . /etc/os-release if [ "$ID" = "debian" ] || [ "$ID" = "ubuntu" ]; then if ! command -v dpkg-architecture &>/dev/null; then @@ -373,4 +377,21 @@ for directory in "${PATCH_ARRAY[@]}"; do while IFS= read -r -d '' file; do ln $verbose -sf "${file/$LD_GTK_LIBRARY_PATH\//}" "$APPDIR/usr/lib" done < <(find "$directory" -name '*.so' -print0) -done \ No newline at end of file +done + + +# set write permission on lib64 again to make it deletable. +chmod +w "$APPDIR"/usr/lib64 || true + +# We have to copy the files first to not get permission errors when we assign gio_extras_dir +find /usr/lib* -name libgiognutls.so -exec mkdir -p "$APPDIR"/"$(dirname '{}')" \; -exec cp --parents '{}' "$APPDIR/" \; || true +# related files that we seemingly don't need: +# libgiolibproxy.so - libgiognomeproxy.so - glib-pacrunner + +gio_extras_dir=$(find "$APPDIR"/usr/lib* -name libgiognutls.so -exec dirname '{}' \; 2>/dev/null) +cat >> "$HOOKFILE" < Date: Mon, 19 May 2025 09:58:10 +0100 Subject: [PATCH 2/3] publish appdir for x86_64 debugging --- .github/workflows/linux-appimage-test.yaml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-appimage-test.yaml b/.github/workflows/linux-appimage-test.yaml index 61a0e65..831d2e6 100644 --- a/.github/workflows/linux-appimage-test.yaml +++ b/.github/workflows/linux-appimage-test.yaml @@ -58,7 +58,7 @@ jobs: - name: Install Ubuntu prerequisites shell: bash - run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev + run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev librsvg2-dev # Build @@ -112,10 +112,24 @@ jobs: # asset_paths: '[]' # Publish to existing release - - name: Upload binaries to release + # - name: Upload binaries to release + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # file: build/linux/${{ steps.define_filename.outputs.filename }}.AppImage + # tag: v0.6.5 + # overwrite: false + + # Also publish the appdir for debugging + - name: zip appdir + shell: bash + run: | + cd build/linux && zip -r ./${{ steps.define_filename.outputs.filename }}_appdir.zip *.AppDir + + - name: Upload zipped appdir to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/linux/${{ steps.define_filename.outputs.filename }}.AppImage + file: build/linux/${{ steps.define_filename.outputs.filename }}_appdir.zip tag: v0.6.5 overwrite: false From ed7649978f8538d5b0bcee59f893dc8b3533c349 Mon Sep 17 00:00:00 2001 From: Sam Webster Date: Mon, 19 May 2025 11:26:07 +0100 Subject: [PATCH 3/3] fix debug upload step --- .github/workflows/linux-appimage-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-appimage-test.yaml b/.github/workflows/linux-appimage-test.yaml index 831d2e6..b4e0f72 100644 --- a/.github/workflows/linux-appimage-test.yaml +++ b/.github/workflows/linux-appimage-test.yaml @@ -124,12 +124,12 @@ jobs: - name: zip appdir shell: bash run: | - cd build/linux && zip -r ./${{ steps.define_filename.outputs.filename }}_appdir.zip *.AppDir + cd build/linux/appimage/build && zip -r ./${{ steps.define_filename.outputs.filename }}_appdir.zip *.AppDir - name: Upload zipped appdir to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/linux/${{ steps.define_filename.outputs.filename }}_appdir.zip + file: build/linux/appimage/build/${{ steps.define_filename.outputs.filename }}_appdir.zip tag: v0.6.5 overwrite: false