diff --git a/flake.nix b/flake.nix index db9a84a..47c32df 100644 --- a/flake.nix +++ b/flake.nix @@ -149,43 +149,27 @@ EOF bumpScript = pkgs.writeShellApplication { name = "moku-bump"; - runtimeInputs = with pkgs; [ gnused coreutils git rustToolchain ]; + runtimeInputs = with pkgs; [ gnused coreutils git rustToolchain + nodejs_22 pnpm + (python3.withPackages (ps: [ ps.aiohttp ps.tomlkit ])) ]; text = '' [[ $# -lt 1 ]] && { echo "Usage: nix run .#bump -- "; exit 1; } VERSION="$1" REPO="$(git rev-parse --show-toplevel)" + + echo "── Bumping version fields to $VERSION ──" sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" \ "$REPO/src-tauri/tauri.conf.json" sed -i "0,/^version = \"[^\"]*\"/s//version = \"$VERSION\"/" \ "$REPO/src-tauri/Cargo.toml" sed -i "s/version = \"[^\"]*\";/version = \"$VERSION\";/g" \ "$REPO/flake.nix" + sed -i "s/^pkgver=.*/pkgver=$VERSION/" "$REPO/PKGBUILD" + sed -i "s/^pkgrel=.*/pkgrel=1/" "$REPO/PKGBUILD" + echo "Done" + + echo "── Regenerating Cargo.lock ──" (cd "$REPO/src-tauri" && cargo generate-lockfile) - echo "Bumped to $VERSION" - ''; - }; - - flatpakScript = pkgs.writeShellApplication { - name = "moku-flatpak"; - runtimeInputs = with pkgs; [ - gnused coreutils git - nodejs_22 pnpm - appstream flatpak-builder flatpak - (python3.withPackages (ps: [ ps.aiohttp ps.tomlkit ])) - ]; - text = '' - [[ $# -lt 1 ]] && { echo "Usage: nix run .#flatpak -- "; exit 1; } - VERSION="$1" - REPO="$(git rev-parse --show-toplevel)" - MANIFEST="$REPO/io.github.moku_project.Moku.yml" - - echo "── Bumping versions ──" - sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" \ - "$REPO/src-tauri/tauri.conf.json" - sed -i "0,/^version = \"[^\"]*\"/s//version = \"$VERSION\"/" \ - "$REPO/src-tauri/Cargo.toml" - sed -i "s/version = \"[^\"]*\";/version = \"$VERSION\";/g" \ - "$REPO/flake.nix" echo "Done" echo "── Building frontend ──" @@ -199,7 +183,15 @@ EOF FRONTEND_SHA=$(sha256sum "$REPO/packaging/frontend-dist.tar.gz" | awk '{print $1}') echo "sha256: $FRONTEND_SHA" - echo "── Patching manifest sha256 ──" + echo "── Regenerating cargo-sources.json ──" + python3 "$REPO/packaging/flatpak-cargo-generator.py" \ + "$REPO/src-tauri/Cargo.lock" \ + -o "$REPO/packaging/cargo-sources.json" + echo "Done" + + echo "── Patching flatpak manifest (version + frontend sha256) ──" + MANIFEST="$REPO/io.github.moku_project.Moku.yml" + sed -i "s/tag: v[^[:space:]]*/tag: v$VERSION/" "$MANIFEST" python3 - "$MANIFEST" "$FRONTEND_SHA" <<'PYEOF' import re, sys path, sha = sys.argv[1], sys.argv[2] @@ -213,13 +205,59 @@ EOF PYEOF echo "Done" - echo "── Regenerating cargo-sources.json ──" - python3 "$REPO/packaging/flatpak-cargo-generator.py" \ - "$REPO/src-tauri/Cargo.lock" \ - -o "$REPO/packaging/cargo-sources.json" + echo "" + echo "Bumped to v$VERSION" + echo "" + echo "Commit field in the flatpak manifest still points to the old tag." + echo "After pushing the tag, run:" + echo " nix run .#post-tag-bump -- $VERSION" + ''; + }; + + postTagBumpScript = pkgs.writeShellApplication { + name = "moku-post-tag-bump"; + runtimeInputs = with pkgs; [ gnused coreutils git curl ]; + text = '' + [[ $# -lt 1 ]] && { echo "Usage: nix run .#post-tag-bump -- "; exit 1; } + VERSION="$1" + REPO="$(git rev-parse --show-toplevel)" + MANIFEST="$REPO/io.github.moku_project.Moku.yml" + PKGBUILD="$REPO/PKGBUILD" + + echo "── Resolving commit for v$VERSION ──" + COMMIT=$(git ls-remote https://github.com/moku-project/Moku.git "refs/tags/v$VERSION" \ + | awk '{print $1}') + [[ -z "$COMMIT" ]] && { echo "ERROR: tag v$VERSION not found on remote"; exit 1; } + echo "commit: $COMMIT" + sed -i "s/commit: [0-9a-f]\{40\}/commit: $COMMIT/" "$MANIFEST" echo "Done" - echo "── Building flatpak ──" + echo "── Fetching PKGBUILD tarball sha256 ──" + TARBALL_URL="https://github.com/moku-project/Moku/archive/refs/tags/v$VERSION.tar.gz" + TARBALL_SHA=$(curl -fsSL "$TARBALL_URL" | sha256sum | awk '{print $1}') + sed -i "s/\(sha256sums=('\)[0-9a-f]\{64\}/\1$TARBALL_SHA/" "$PKGBUILD" + grep -q "$TARBALL_SHA" "$PKGBUILD" \ + || { echo "ERROR: PKGBUILD sha256 replacement failed"; exit 1; } + echo "Done" + + echo "" + echo "post-tag-bump complete for v$VERSION" + ''; + }; + + flatpakScript = pkgs.writeShellApplication { + name = "moku-flatpak"; + runtimeInputs = with pkgs; [ + gnused coreutils git + appstream flatpak-builder flatpak + ]; + text = '' + [[ $# -lt 1 ]] && { echo "Usage: nix run .#flatpak -- "; exit 1; } + VERSION="$1" + REPO="$(git rev-parse --show-toplevel)" + MANIFEST="$REPO/io.github.moku_project.Moku.yml" + + echo "── Building flatpak for v$VERSION ──" rm -rf "$REPO/build-dir" "$REPO/repo" flatpak-builder \ --repo="$REPO/repo" \ @@ -228,14 +266,9 @@ EOF "$MANIFEST" flatpak build-bundle "$REPO/repo" "$REPO/moku.flatpak" io.github.moku_project.Moku rm -rf "$REPO/build-dir" "$REPO/repo" - echo "moku.flatpak created" echo "" - echo "Done — v$VERSION" - echo " -> $REPO/moku.flatpak" - echo "" - echo "After pushing the tag, run:" - echo " nix run .#pkgbuild-bump -- $VERSION" + echo "moku.flatpak created — v$VERSION" ''; }; @@ -279,6 +312,7 @@ EOF default = { type = "app"; program = "${moku}/bin/moku"; }; moku = { type = "app"; program = "${moku}/bin/moku"; }; bump = { type = "app"; program = "${bumpScript}/bin/moku-bump"; }; + post-tag-bump = { type = "app"; program = "${postTagBumpScript}/bin/moku-post-tag-bump"; }; flatpak = { type = "app"; program = "${flatpakScript}/bin/moku-flatpak"; }; pkgbuild-bump = { type = "app"; program = "${pkgbuildBumpScript}/bin/moku-pkgbuild-bump"; }; tunnel = { type = "app"; program = "${tunnelScript}/bin/moku-tunnel"; }; @@ -309,10 +343,11 @@ EOF echo "Moku dev shell — pnpm install && pnpm tauri:dev" echo "" - echo "Release:" - echo " nix run .#bump -- bump versions only" - echo " nix run .#flatpak -- full flatpak build" - echo " nix run .#pkgbuild-bump -- patch PKGBUILD (after tag push)" + echo "Release workflow:" + echo " nix run .#bump -- bump all versions + rebuild artifacts" + echo " git commit && git tag && git push" + echo " nix run .#post-tag-bump -- patch manifest commit + PKGBUILD sha" + echo " nix run .#flatpak -- build moku.flatpak" echo " nix run .#tunnel -- [port] cloudflare tunnel (default 4567)" ''; }; diff --git a/io.github.moku_project.Moku.yml b/io.github.moku_project.Moku.yml index 885fac8..1e255e0 100644 --- a/io.github.moku_project.Moku.yml +++ b/io.github.moku_project.Moku.yml @@ -183,7 +183,7 @@ modules: commit: 514910667b0d6e375569a48fb7cef11411d30fbd - type: file path: packaging/frontend-dist.tar.gz - sha256: 6e47122099676be637e565904d6f4d173f692c472061916b0ef3fb7d2e4625a8 + sha256: ca1971abec454446d35d7a452081995002ac5dc61bfdfd45b4d0dfeeedddc063 - packaging/cargo-sources.json - type: inline dest: src-tauri/.cargo diff --git a/packaging/cargo-sources.json b/packaging/cargo-sources.json index b53a735..87cd1be 100644 --- a/packaging/cargo-sources.json +++ b/packaging/cargo-sources.json @@ -2166,14 +2166,14 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/idna_adapter/idna_adapter-1.2.1.crate", - "sha256": "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344", - "dest": "cargo/vendor/idna_adapter-1.2.1" + "url": "https://static.crates.io/crates/idna_adapter/idna_adapter-1.2.2.crate", + "sha256": "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714", + "dest": "cargo/vendor/idna_adapter-1.2.2" }, { "type": "inline", - "contents": "{\"package\": \"3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344\", \"files\": {}}", - "dest": "cargo/vendor/idna_adapter-1.2.1", + "contents": "{\"package\": \"cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714\", \"files\": {}}", + "dest": "cargo/vendor/idna_adapter-1.2.2", "dest-filename": ".cargo-checksum.json" }, { @@ -3570,14 +3570,14 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/plist/plist-1.8.0.crate", - "sha256": "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07", - "dest": "cargo/vendor/plist-1.8.0" + "url": "https://static.crates.io/crates/plist/plist-1.9.0.crate", + "sha256": "092791278e026273c1b65bbdcfbba3a300f2994c896bd01ab01da613c29c46f1", + "dest": "cargo/vendor/plist-1.9.0" }, { "type": "inline", - "contents": "{\"package\": \"740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07\", \"files\": {}}", - "dest": "cargo/vendor/plist-1.8.0", + "contents": "{\"package\": \"092791278e026273c1b65bbdcfbba3a300f2994c896bd01ab01da613c29c46f1\", \"files\": {}}", + "dest": "cargo/vendor/plist-1.9.0", "dest-filename": ".cargo-checksum.json" }, { @@ -3778,14 +3778,14 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/quick-xml/quick-xml-0.38.4.crate", - "sha256": "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c", - "dest": "cargo/vendor/quick-xml-0.38.4" + "url": "https://static.crates.io/crates/quick-xml/quick-xml-0.39.2.crate", + "sha256": "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d", + "dest": "cargo/vendor/quick-xml-0.39.2" }, { "type": "inline", - "contents": "{\"package\": \"b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c\", \"files\": {}}", - "dest": "cargo/vendor/quick-xml-0.38.4", + "contents": "{\"package\": \"958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d\", \"files\": {}}", + "dest": "cargo/vendor/quick-xml-0.39.2", "dest-filename": ".cargo-checksum.json" }, { @@ -4168,14 +4168,14 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/reqwest/reqwest-0.13.2.crate", - "sha256": "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801", - "dest": "cargo/vendor/reqwest-0.13.2" + "url": "https://static.crates.io/crates/reqwest/reqwest-0.13.3.crate", + "sha256": "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0", + "dest": "cargo/vendor/reqwest-0.13.3" }, { "type": "inline", - "contents": "{\"package\": \"ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801\", \"files\": {}}", - "dest": "cargo/vendor/reqwest-0.13.2", + "contents": "{\"package\": \"62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0\", \"files\": {}}", + "dest": "cargo/vendor/reqwest-0.13.3", "dest-filename": ".cargo-checksum.json" }, { @@ -5343,14 +5343,14 @@ { "type": "archive", "archive-type": "tar-gzip", - "url": "https://static.crates.io/crates/tauri-winres/tauri-winres-0.3.5.crate", - "sha256": "1087b111fe2b005e42dbdc1990fc18593234238d47453b0c99b7de1c9ab2c1e0", - "dest": "cargo/vendor/tauri-winres-0.3.5" + "url": "https://static.crates.io/crates/tauri-winres/tauri-winres-0.3.6.crate", + "sha256": "cc65d45c68858bfe420dd29e834b5d15dbecf8a07a8a16cf4d532c7b1f69d4b6", + "dest": "cargo/vendor/tauri-winres-0.3.6" }, { "type": "inline", - "contents": "{\"package\": \"1087b111fe2b005e42dbdc1990fc18593234238d47453b0c99b7de1c9ab2c1e0\", \"files\": {}}", - "dest": "cargo/vendor/tauri-winres-0.3.5", + "contents": "{\"package\": \"cc65d45c68858bfe420dd29e834b5d15dbecf8a07a8a16cf4d532c7b1f69d4b6\", \"files\": {}}", + "dest": "cargo/vendor/tauri-winres-0.3.6", "dest-filename": ".cargo-checksum.json" }, { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3e90a5c..c337729 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -27,9 +27,7 @@ }, "bundle": { "active": true, - "targets": [ - "nsis" - ], + "targets": ["nsis"], "icon": [ "icons/32x32.png", "icons/128x128.png", @@ -49,10 +47,6 @@ "plugins": { "shell": { "open": true - }, - "updater": { - "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM2NEQzNDdFRjlDNUVEN0MKUldSODdjWDVmalJOTml1b0xzMDU3ZE1sNWJLZUhqUDN5cmJUdkdpeFlEVGNoQVN3UjhCc3AxV3QK", - "endpoints": [] } } -} +} \ No newline at end of file diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index fce4099..5b78fae 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -1,20 +1,8 @@ { "bundle": { - "createUpdaterArtifacts": true, "resources": [ "binaries/suwayomi-bundle/bin/Suwayomi-Server.jar", "binaries/suwayomi-bundle/jre/**/*" ] - }, - "plugins": { - "updater": { - "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM2NEQzNDdFRjlDNUVEN0MKUldSODdjWDVmalJOTml1b0xzMDU3ZE1sNWJLZUhqUDN5cmJUdkdpeFlEVGNoQVN3UjhCc3AxV3QK", - "endpoints": [ - "https://github.com/moku-project/Moku/releases/latest/download/latest.json" - ], - "windows": { - "installMode": "passive" - } - } } } \ No newline at end of file