Files
shell-rs/packaging/make-manifest.sh
T
bigtan e91bab0d09 macOS 按 Apple Silicon 和 Intel 分别发布安装包
发布流程改为按 aarch64、x86_64 构建矩阵,分别签名、公证并上传 DMG 和升级 ZIP,
不再合成 universal 应用。两个任务使用独立缓存和产物名称,发布时收集全部架构。

更新清单保留原有平台键,分别记录对应架构包的地址、大小和 SHA-256。
已有 universal 客户端按运行架构升级;Rosetta 下的 Intel 版仍接收 Intel 包。
同步更新中英文下载说明、发布文档和示例清单,增加双架构校验与错包拒绝断言。

验证:52 项更新模块测试通过,Clippy、格式、YAML 和 shell 语法检查通过。
2026-10-10 22:33:22 +08:00

105 lines
3.3 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_arm="ShellRS-$version-macos-aarch64.app.zip"
mac_intel="ShellRS-$version-macos-x86_64.app.zip"
dmg_arm="ShellRS-$version-macos-aarch64.dmg"
dmg_intel="ShellRS-$version-macos-x86_64.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_arm "$(asset "$mac_arm")" \
--argjson mac_intel "$(asset "$mac_intel")" \
--argjson win "$(asset "$win")" \
--argjson linux "$(asset "$linux")" \
--arg dmg_arm "$base/$dmg_arm" \
--arg dmg_intel "$base/$dmg_intel" \
--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_arm,
"macos-x86_64": $mac_intel,
"windows-x86_64": $win,
"linux-x86_64": $linux
},
installers: {
"macos-aarch64": $dmg_arm,
"macos-x86_64": $dmg_intel,
"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"