build: publish portable desktop releases

This commit is contained in:
mirivlad 2026-07-14 01:58:42 +08:00
parent da76b89856
commit 660833140d
5 changed files with 51 additions and 57 deletions

View File

@ -188,21 +188,19 @@ sidecar for its target OS.
## Publish a GitHub Release ## Publish a GitHub Release
The current publisher still uses the legacy Linux tarball. It will be switched
to the portable artifacts after they have been manually checked:
```bash ```bash
./scripts/publish-github-release.sh v0.1.0-alpha.1 ./scripts/publish-github-release.sh v0.1.0-alpha.1
``` ```
The command requires an authenticated [`gh`](https://cli.github.com/) CLI, a The command requires an authenticated [`gh`](https://cli.github.com/) CLI, a
clean local `main` equal to `origin/main`, and the sibling official-plugins clean local `main` equal to `origin/main`, and the sibling official-plugins
checkout. It runs the local release script, creates an annotated Git tag when checkout. It builds the Debian package, Linux AppImage and Windows portable
needed, pushes that tag through `origin`, then creates or updates the GitHub ZIP, then creates or updates the GitHub Release with those three artifacts and
Release with the archive and `SHA256SUMS`. In this checkout `origin` also `SHA256SUMS`. Alpha, beta and release-candidate tags are marked as GitHub
pushes the tag to the configured mirror; other maintainers can add a second prereleases; stable tags are marked latest. The command creates an annotated
push URL if they use a mirror too. Publish the compatible official-plugins tag when needed and pushes it through `origin`, which also mirrors tags in this
release before publishing the desktop archive that embeds those plugins. checkout. Publish the compatible official-plugins release before the desktop
release that embeds those plugins.
## License ## License

View File

@ -39,15 +39,18 @@ fi
"$RELEASE_SCRIPT" "$VERSION" "$RELEASE_SCRIPT" "$VERSION"
shopt -s nullglob ASSETS=(
ASSETS=("$RELEASE_DIR"/*.tar.gz "$RELEASE_DIR"/*.tgz) "$RELEASE_DIR/verstak_${VERSION#v}_amd64.deb"
if [[ -f "$RELEASE_DIR/SHA256SUMS" ]]; then "$RELEASE_DIR/verstak-linux-x86_64-$VERSION.AppImage"
ASSETS+=("$RELEASE_DIR/SHA256SUMS") "$RELEASE_DIR/verstak-windows-amd64-$VERSION.zip"
fi "$RELEASE_DIR/SHA256SUMS"
if [[ ${#ASSETS[@]} -eq 0 ]]; then )
echo "no release assets found in $RELEASE_DIR" >&2 for asset in "${ASSETS[@]}"; do
exit 1 if [[ ! -s "$asset" ]]; then
fi echo "required release asset is missing or empty: $asset" >&2
exit 1
fi
done
if "$GIT_BIN" rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then if "$GIT_BIN" rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then
if [[ "$("$GIT_BIN" rev-parse "${VERSION}^{commit}")" != "$HEAD" ]]; then if [[ "$("$GIT_BIN" rev-parse "${VERSION}^{commit}")" != "$HEAD" ]]; then
@ -62,12 +65,16 @@ fi
if "$GH_BIN" release view "$VERSION" --repo "$REPOSITORY" >/dev/null 2>&1; then if "$GH_BIN" release view "$VERSION" --repo "$REPOSITORY" >/dev/null 2>&1; then
"$GH_BIN" release upload "$VERSION" "${ASSETS[@]}" --repo "$REPOSITORY" --clobber "$GH_BIN" release upload "$VERSION" "${ASSETS[@]}" --repo "$REPOSITORY" --clobber
else else
RELEASE_OPTIONS=(--generate-notes --verify-tag)
if [[ "$VERSION" == *-* ]]; then
RELEASE_OPTIONS+=(--prerelease)
else
RELEASE_OPTIONS+=(--latest)
fi
"$GH_BIN" release create "$VERSION" "${ASSETS[@]}" \ "$GH_BIN" release create "$VERSION" "${ASSETS[@]}" \
--repo "$REPOSITORY" \ --repo "$REPOSITORY" \
--title "Verstak $VERSION" \ --title "Verstak $VERSION" \
--generate-notes \ "${RELEASE_OPTIONS[@]}"
--latest \
--verify-tag
fi fi
echo "GitHub release:" echo "GitHub release:"

View File

@ -10,40 +10,17 @@ if [[ -z "$VERSION" || ! "$VERSION" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then
exit 2 exit 2
fi fi
if ! command -v pkg-config >/dev/null || \
(! pkg-config --exists webkit2gtk-4.1 && ! pkg-config --exists webkit2gtk-4.0); then
echo "Linux desktop releases require libwebkit2gtk-4.1-dev or libwebkit2gtk-4.0-dev." >&2
exit 1
fi
OFFICIAL_PLUGINS="${VERSTAK_OFFICIAL_PLUGINS_DIR:-$ROOT/../verstak-official-plugins}"
if [[ ! -d "$OFFICIAL_PLUGINS" ]]; then
echo "official plugins repository not found: $OFFICIAL_PLUGINS" >&2
exit 1
fi
echo "=== verstak desktop release $VERSION ===" echo "=== verstak desktop release $VERSION ==="
(cd "$OFFICIAL_PLUGINS" && ./scripts/build.sh)
"$ROOT/scripts/install-dev-plugins.sh"
"$ROOT/scripts/build.sh"
BINARY="$(find "$ROOT/build/bin" -maxdepth 1 -type f -name 'verstak-desktop*' -print -quit)"
if [[ -z "$BINARY" ]]; then
echo "desktop binary was not produced in build/bin" >&2
exit 1
fi
RELEASE_ROOT="$ROOT/release" RELEASE_ROOT="$ROOT/release"
STAGING="$RELEASE_ROOT/verstak-desktop-$VERSION-linux-amd64" rm -rf "$RELEASE_ROOT"
ARCHIVE="$RELEASE_ROOT/verstak-desktop-linux-amd64-$VERSION.tar.gz" mkdir -p "$RELEASE_ROOT"
rm -rf "$STAGING" "$ARCHIVE"
mkdir -p "$STAGING"
cp "$BINARY" "$STAGING/verstak-desktop" "$ROOT/scripts/package-deb.sh" "$VERSION"
cp "$ROOT/README.md" "$ROOT/LICENSE" "$STAGING/" "$ROOT/scripts/package-appimage.sh" "$VERSION"
cp -R "$ROOT/plugins" "$STAGING/plugins" "$ROOT/scripts/package-windows-portable.sh" "$VERSION"
tar -C "$RELEASE_ROOT" -czf "$ARCHIVE" "$(basename "$STAGING")"
(cd "$RELEASE_ROOT" && sha256sum "$(basename "$ARCHIVE")" > SHA256SUMS)
echo "release archive: $ARCHIVE" (cd "$RELEASE_ROOT" && find . -maxdepth 1 -type f \( -name '*.deb' -o -name '*.AppImage' -o -name '*.zip' \) \
echo "checksums: $RELEASE_ROOT/SHA256SUMS" -printf '%f\n' | LC_ALL=C sort | xargs -r sha256sum > SHA256SUMS)
echo "release assets: $RELEASE_ROOT"
echo "checksums: $RELEASE_ROOT/SHA256SUMS"

View File

@ -33,6 +33,9 @@ fi
grep -Fq 'zip -qr' "$ROOT/scripts/package-windows-portable.sh" grep -Fq 'zip -qr' "$ROOT/scripts/package-windows-portable.sh"
grep -Fq 'LinkId=2124701' "$ROOT/README.md" grep -Fq 'LinkId=2124701' "$ROOT/README.md"
grep -Fq 'WebView2 Runtime' "$ROOT/README.md" grep -Fq 'WebView2 Runtime' "$ROOT/README.md"
grep -Fq 'package-deb.sh' "$ROOT/scripts/release.sh"
grep -Fq 'package-appimage.sh' "$ROOT/scripts/release.sh"
grep -Fq 'package-windows-portable.sh' "$ROOT/scripts/release.sh"
grep -Fq 'chmod -R a+rX' "$ROOT/scripts/build-linux-bundle.sh" grep -Fq 'chmod -R a+rX' "$ROOT/scripts/build-linux-bundle.sh"
echo "desktop package script contracts passed" echo "desktop package script contracts passed"

View File

@ -5,7 +5,11 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PUBLISHER="$ROOT/scripts/publish-github-release.sh" PUBLISHER="$ROOT/scripts/publish-github-release.sh"
VERSION="v0.0.0-test" VERSION="v0.0.0-test"
REPOSITORY="mirivlad/verstak" REPOSITORY="mirivlad/verstak"
ASSET_NAME="verstak-desktop-linux-amd64-${VERSION}.tar.gz" ASSET_NAMES=(
"verstak_0.0.0-test_amd64.deb"
"verstak-linux-x86_64-v0.0.0-test.AppImage"
"verstak-windows-amd64-v0.0.0-test.zip"
)
WORK="$(mktemp -d)" WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT trap 'rm -rf "$WORK"' EXIT
@ -22,7 +26,9 @@ cat > "$WORK/release.sh" <<'SCRIPT'
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
printf 'release:%s\n' "$1" >> "$LOG" printf 'release:%s\n' "$1" >> "$LOG"
printf 'archive\n' > "$VERSTAK_RELEASE_DIR/verstak-desktop-linux-amd64-$1.tar.gz" printf 'deb\n' > "$VERSTAK_RELEASE_DIR/verstak_${1#v}_amd64.deb"
printf 'appimage\n' > "$VERSTAK_RELEASE_DIR/verstak-linux-x86_64-$1.AppImage"
printf 'zip\n' > "$VERSTAK_RELEASE_DIR/verstak-windows-amd64-$1.zip"
printf 'checksum\n' > "$VERSTAK_RELEASE_DIR/SHA256SUMS" printf 'checksum\n' > "$VERSTAK_RELEASE_DIR/SHA256SUMS"
SCRIPT SCRIPT
chmod +x "$WORK/release.sh" chmod +x "$WORK/release.sh"
@ -82,8 +88,11 @@ grep -Fqx "release:$VERSION" "$LOG"
grep -Fqx "tag:$VERSION" "$LOG" grep -Fqx "tag:$VERSION" "$LOG"
grep -Fqx "push:origin:refs/tags/$VERSION" "$LOG" grep -Fqx "push:origin:refs/tags/$VERSION" "$LOG"
grep -F "release create $VERSION" "$LOG" >/dev/null grep -F "release create $VERSION" "$LOG" >/dev/null
grep -F "$ASSET_NAME" "$LOG" >/dev/null for asset in "${ASSET_NAMES[@]}"; do
grep -F "$asset" "$LOG" >/dev/null
done
grep -F "SHA256SUMS" "$LOG" >/dev/null grep -F "SHA256SUMS" "$LOG" >/dev/null
grep -F -- "--prerelease" "$LOG" >/dev/null
run_publisher run_publisher
grep -F "release upload $VERSION" "$LOG" >/dev/null grep -F "release upload $VERSION" "$LOG" >/dev/null