From 82a3cb967487d0d8d55f50df871c8c60d29cda64 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Sat, 24 Jan 2026 04:21:36 +1100 Subject: [PATCH] Add auto-updater support for Linux with Gitea releases --- .gitea/workflows/build.yml | 75 ++++++++++++++++++++++++++++++++ src-tauri/.gitignore | 2 + src-tauri/.tauri-private.key.pub | 1 + src-tauri/Cargo.toml | 1 + src-tauri/src/lib.rs | 1 + src-tauri/tauri.conf.json | 6 +++ 6 files changed, 86 insertions(+) create mode 100644 src-tauri/.tauri-private.key.pub diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 1d5c8d6..a8d5ecc 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -5,6 +5,11 @@ on: branches: - main - dev + tags: + - 'v*' + +env: + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} jobs: build-windows: @@ -92,6 +97,10 @@ jobs: cp src-tauri/target/release/bundle/appimage/*.AppImage src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage cp src-tauri/target/release/bundle/deb/*.deb src-tauri/target/release/bundle/deb/Cinny-Linux-x64.deb cp src-tauri/target/release/bundle/rpm/*.rpm src-tauri/target/release/bundle/rpm/Cinny-Linux-x64.rpm + # Copy signature file for updater + if [ -f src-tauri/target/release/bundle/appimage/*.AppImage.sig ]; then + cp src-tauri/target/release/bundle/appimage/*.AppImage.sig src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig + fi - name: Upload AppImage uses: actions/upload-artifact@v3 @@ -99,6 +108,13 @@ jobs: name: Cinny-Linux-x64.AppImage path: src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage + - name: Upload AppImage Signature + uses: actions/upload-artifact@v3 + if: always() + with: + name: Cinny-Linux-x64.AppImage.sig + path: src-tauri/target/release/bundle/appimage/Cinny-Linux-x64.AppImage.sig + - name: Upload DEB package uses: actions/upload-artifact@v3 with: @@ -209,3 +225,62 @@ jobs: with: name: Cinny-Android.apk path: src-tauri/gen/android/app/build/outputs/apk/universal/release/Cinny-Android.apk + + create-release: + runs-on: ubuntu-latest + needs: [build-windows, build-linux, build-android] + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + + - name: Get version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Create update.json + run: | + VERSION="${{ steps.version.outputs.VERSION }}" + APPIMAGE_SIG="" + if [ -f "artifacts/Cinny-Linux-x64.AppImage.sig/Cinny-Linux-x64.AppImage.sig" ]; then + APPIMAGE_SIG=$(cat "artifacts/Cinny-Linux-x64.AppImage.sig/Cinny-Linux-x64.AppImage.sig") + fi + + cat > update.json << EOF + { + "version": "${VERSION}", + "notes": "Update to version ${VERSION}", + "pub_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", + "platforms": { + "linux-x86_64": { + "signature": "${APPIMAGE_SIG}", + "url": "http://synbox.ruv.wtf:8418/litruv/cinny-desktop/releases/download/v${VERSION}/Cinny-Linux-x64.AppImage" + } + } + } + EOF + cat update.json + + - name: Prepare release files + run: | + mkdir -p release-files + # Move artifacts out of subdirectories + find artifacts -type f \( -name "*.msi" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.apk" -o -name "*.sig" \) -exec cp {} release-files/ \; + cp update.json release-files/ + ls -la release-files/ + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: release-files/* + draft: false + prerelease: false + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore index c123704..929e7d5 100644 --- a/src-tauri/.gitignore +++ b/src-tauri/.gitignore @@ -2,3 +2,5 @@ # will have compiled files and executables /target/ WixTools + +.tauri-private.key diff --git a/src-tauri/.tauri-private.key.pub b/src-tauri/.tauri-private.key.pub new file mode 100644 index 0000000..0283b07 --- /dev/null +++ b/src-tauri/.tauri-private.key.pub @@ -0,0 +1 @@ +dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDExREU1NkVBMDY4MzcxMjAKUldRZ2NZTUc2bGJlRVNaQldnMXpJcHlocVpCWUNNaUdicjBGMVRsck1GQXhvTnJiOUNhVVRHSzQK \ No newline at end of file diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 00b86f5..8df87a1 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -32,6 +32,7 @@ tauri-plugin-deep-link = "2" [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] tauri-plugin-single-instance = "2" +tauri-plugin-updater = "2" [features] default = ["custom-protocol"] diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 237d129..9b71db6 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -18,6 +18,7 @@ pub fn run() { .plugin(tauri_plugin_window_state::Builder::default().build()) .plugin(tauri_plugin_single_instance::init(|_app, _args, _cwd| {})) .plugin(tauri_plugin_notification::init()) + .plugin(tauri_plugin_updater::Builder::new().build()) }; #[cfg(any(target_os = "android", target_os = "ios"))] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index ecdea09..0fed4d6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -28,6 +28,12 @@ "plugins": { "notification": { "sound": true + }, + "updater": { + "endpoints": [ + "http://synbox.ruv.wtf:8418/litruv/cinny-desktop/releases/download/latest/update.json" + ], + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDExREU1NkVBMDY4MzcxMjAKUldRZ2NZTUc2bGJlRVNaQldnMXpJcHlocVpCWUNNaUdicjBGMVRsck1GQXhvTnJiOUNhVVRHSzQK" } }, "bundle": {