Files
shell-rs/packaging/make-manifest.sh
Xuz f0690fe6b2 在线升级:后台检查、下载并在重启或退出时安装新版本,发布流水线与应用图标
- 新增 update 模块:从 dl.shellrs.com 取已签名的更新清单(minisign,签名绑定通道和版本),
  按大小和 SHA-256 校验安装包;下载可续传、可换镜像,走系统代理
- 按安装方式安装:macOS 整包交换并核对开发者签名,Windows 静默运行安装程序,Linux 覆盖 AppImage;
  开发构建和无法自更新的安装只提示前往下载页
- 设置新增「关于」:版本信息、检查更新、下载进度和「自动检查并下载更新」开关;
  新版本就绪后标题栏右上角提示,更新对话框写明重启会中断什么;退出时自动安装,新版本启动后提示已更新
- 数据库拒绝打开更新版本建的库,迁移已有的库之前先备份成 shellrs.db.v<旧版本>.bak
- 新增 release workflow 和 packaging 脚本:universal macOS 包签名公证、Inno Setup 安装程序、
  AppImage、上传 R2、生成并签名更新清单;新增 CHANGELOG.md
- 应用图标放在 assets/logo;开发模式下 macOS Dock 显示 logo,Windows exe 嵌入图标
- 修正 AppImage 里 shellrs 命令链接到临时挂载点;启动时刷新已安装但过期的 Agent skill
- 新增清单、验签、下载、各平台安装器和界面的单元测试与 UI 测试
2026-10-01 12:33:01 +08:00

101 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Write the signed update manifest of one release for one channel.
#
# packaging/make-manifest.sh <version> <channel> <notes.md> <dist-dir> <out.json>
#
# <dist-dir> holds the release's packages under their published names.
# MINISIGN_KEY_FILE is the secret key; MINISIGN_PASSWORD its password, if it
# has one. SHELLRS_MIRROR_BASE, when set (e.g. the GitHub release download
# URL of a public repository), adds a second address for every package.
#
# The output is the envelope src/update/manifest.rs reads: the manifest's
# exact text and its minisign signature, whose trusted comment
# `shellrs-manifest <channel> <version>` the client checks. The format only
# ever gains fields; packaging/manifest.example.json shows it.
set -euo pipefail
version=$1
channel=$2
notes=$3
dist=$4
out=$5
base="https://dl.shellrs.com/releases/$version"
mirror=${SHELLRS_MIRROR_BASE:-}
mac="ShellRS-$version-macos-universal.app.zip"
dmg="ShellRS-$version-macos-universal.dmg"
win="ShellRS-$version-windows-x86_64-setup.exe"
linux="ShellRS-$version-linux-x86_64.AppImage"
sha256() {
if command -v sha256sum >/dev/null; then
sha256sum "$1" | cut -d' ' -f1
else
shasum -a 256 "$1" | cut -d' ' -f1
fi
}
# The asset entry of one package: its addresses, size and SHA-256.
asset() {
local file="$dist/$1"
local size
size=$(wc -c <"$file" | tr -d ' ')
jq -n \
--arg url "$base/$1" \
--arg mirror "${mirror:+$mirror/$1}" \
--argjson size "$size" \
--arg sha256 "$(sha256 "$file")" \
'{urls: ([$url] + (if $mirror == "" then [] else [$mirror] end)), size: $size, sha256: $sha256}'
}
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
jq -n -j \
--arg version "$version" \
--arg channel "$channel" \
--arg published "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--rawfile notes "$notes" \
--arg notes_url "https://shellrs.com/changelog#$version" \
--argjson mac "$(asset "$mac")" \
--argjson win "$(asset "$win")" \
--argjson linux "$(asset "$linux")" \
--arg dmg "$base/$dmg" \
--arg win_url "$base/$win" \
--arg linux_url "$base/$linux" \
'{
schema: 1,
channel: $channel,
version: $version,
published_at: $published,
minimum_version: null,
rollout: 1.0,
notes: $notes,
notes_url: $notes_url,
assets: {
"macos-aarch64": $mac,
"macos-x86_64": $mac,
"windows-x86_64": $win,
"linux-x86_64": $linux
},
installers: {
"macos-aarch64": $dmg,
"macos-x86_64": $dmg,
"windows-x86_64": $win_url,
"linux-x86_64": $linux_url
}
}' >"$work/manifest.json"
printf '%s\n' "${MINISIGN_PASSWORD:-}" | minisign -S \
-s "$MINISIGN_KEY_FILE" \
-m "$work/manifest.json" \
-x "$work/manifest.json.minisig" \
-t "shellrs-manifest $channel $version"
jq -n \
--rawfile manifest "$work/manifest.json" \
--rawfile signature "$work/manifest.json.minisig" \
'{manifest: $manifest, signature: $signature}' >"$out"
echo "$out"