From 47c1db9979619a5ea1699d6d03a0f06aeed57f8f Mon Sep 17 00:00:00 2001 From: mirivlad Date: Mon, 13 Jul 2026 22:29:46 +0800 Subject: [PATCH] build: add portable plugin archives --- README.md | 25 ++++++++------------- scripts/package-portable.sh | 37 ++++++++++++++++++++++++++++++++ scripts/test-package-portable.sh | 21 ++++++++++++++++++ 3 files changed, 67 insertions(+), 16 deletions(-) create mode 100755 scripts/package-portable.sh create mode 100755 scripts/test-package-portable.sh diff --git a/README.md b/README.md index 62b4811..07beddc 100644 --- a/README.md +++ b/README.md @@ -28,19 +28,21 @@ cd ../verstak-desktop ./scripts/install-dev-plugins.sh ``` -## Windows test packages from Linux +## Portable plugin archives -Install a MinGW cross-compiler, then build a separate Windows amd64 package -tree: +Build target-specific archives on Linux: ```bash sudo apt install gcc-mingw-w64-x86-64 -./scripts/build-windows.sh +./scripts/package-portable.sh v0.1.0-alpha.1 ``` -The result is `dist-windows/`. Go sidecars, when a plugin has one, are emitted -as `backend/.exe`; frontends and manifests are the same packaged -files used on Linux. This is a local test output and is not a GitHub Release. +The command creates `release/verstak-official-plugins-linux-amd64-.tar.gz` +and `release/verstak-official-plugins-windows-amd64-.zip`, plus +`SHA256SUMS`. Each archive expands directly into the desktop application's +`plugins/` directory. Frontends and manifests are shared; native Go sidecars +are built for the target OS. This is a local package operation and does not +create a GitHub Release. ## Alpha behaviour @@ -52,15 +54,6 @@ files used on Linux. This is a local test output and is not a GitHub Release. explicit unassigned scope. Journal creation is always a user action. - Todo is optional: Overview uses it only when the Todo capability is present. -## Release package - -```bash -./scripts/release.sh v0.1.0-alpha.1 -``` - -The command rebuilds all packages and writes -`release/verstak-official-plugins-.tar.gz` plus `SHA256SUMS`. - ## Publish a GitHub Release ```bash diff --git a/scripts/package-portable.sh b/scripts/package-portable.sh new file mode 100755 index 0000000..f026e98 --- /dev/null +++ b/scripts/package-portable.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +VERSION="${1:-}" + +if [[ -z "$VERSION" || ! "$VERSION" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then + echo "usage: $0 " >&2 + echo "example: $0 v0.1.0-alpha.1" >&2 + exit 2 +fi + +if ! command -v zip >/dev/null; then + echo "zip is required to create the Windows plugin archive" >&2 + exit 1 +fi + +echo "=== verstak official portable plugin packages $VERSION ===" +"$ROOT/scripts/build.sh" +"$ROOT/scripts/build-windows.sh" + +RELEASE_ROOT="$ROOT/release" +LINUX_ARCHIVE="$RELEASE_ROOT/verstak-official-plugins-linux-amd64-$VERSION.tar.gz" +WINDOWS_ARCHIVE="$RELEASE_ROOT/verstak-official-plugins-windows-amd64-$VERSION.zip" +rm -rf "$RELEASE_ROOT" +mkdir -p "$RELEASE_ROOT" + +# Each archive expands directly into the desktop application's plugins/ +# directory. Frontends and manifests are shared; platform-test's native +# sidecar is built for the target operating system. +tar -C "$ROOT/dist" -czf "$LINUX_ARCHIVE" . +(cd "$ROOT/dist-windows" && zip -qr "$WINDOWS_ARCHIVE" .) +(cd "$RELEASE_ROOT" && sha256sum "$(basename "$LINUX_ARCHIVE")" "$(basename "$WINDOWS_ARCHIVE")" > SHA256SUMS) + +echo "Linux plugins: $LINUX_ARCHIVE" +echo "Windows plugins: $WINDOWS_ARCHIVE" +echo "checksums: $RELEASE_ROOT/SHA256SUMS" diff --git a/scripts/test-package-portable.sh b/scripts/test-package-portable.sh new file mode 100755 index 0000000..dd5d3f7 --- /dev/null +++ b/scripts/test-package-portable.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +PACKAGER="$ROOT/scripts/package-portable.sh" + +if [[ ! -x "$PACKAGER" ]]; then + echo "portable plugin packager is missing or not executable: $PACKAGER" >&2 + exit 1 +fi + +bash -n "$PACKAGER" +grep -Fq 'scripts/build.sh' "$PACKAGER" +grep -Fq 'scripts/build-windows.sh' "$PACKAGER" +grep -Fq 'verstak-official-plugins-linux-amd64-' "$PACKAGER" +grep -Fq 'verstak-official-plugins-windows-amd64-' "$PACKAGER" +grep -Fq 'tar -C' "$PACKAGER" +grep -Fq 'zip -qr' "$PACKAGER" +grep -Fq 'SHA256SUMS' "$PACKAGER" + +echo "portable plugin package script contract passed"