2698116696
- compile-android.sh: 建 libbox.aar + split-per-abi 取 arm64-v8a(~82MB, 避 232MB universal) + release 签名(RELEASE_KEYSTORE/KEY_PASSWORD)。本地已验证构建通过、 libbox.so 打进 APK。 - compile-windows.sh: 复用 client/windows/installer/pangolin.iss(Inno Setup),不签名。 - release-client.sh / deploy-client.sh: 复用 pangolin lib-forgejo/lib-ssh,传 Gitea release + 部署最新到 pangolin1:/var/lib/pangolin/downloads(仅留最新)。 - deploy-client.yml: client-v* tag → build-android(mac)+build-windows(windows) → release-deploy(mac)。 - build.gradle: 补 release 签名 config(读 key.properties, 缺则回退 debug)。 - 待确认: keystore alias/密码(见脚本 TODO);runner 需提到 user 级;服务器 /downloads + 官网链接下一步。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
77 lines
4.0 KiB
Bash
Executable File
77 lines
4.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# deploy-client.sh <tag> — publish the latest Android/Windows client
|
|
# installers to pangolin1's public downloads directory. Keeps only the single
|
|
# latest file per platform (jiu-style "only latest" — see jiu's
|
|
# deploy-client.sh /opt/jiu/downloads handling), overwriting whatever a
|
|
# previous release published under the same stable filename.
|
|
#
|
|
# Mirrors ~/code/jiu/scripts/ci/deploy-client.sh's "only latest" downloads
|
|
# publish, but uses pangolin's own lib-ssh.sh API (setup_ssh / $SSH /
|
|
# $RSYNC_SSH, DEPLOY_HOST defaulting to pangolin1's IP — different from
|
|
# jiu's lib-forgejo.sh-embedded setup_ssh/EC2_HOST convention) and drops
|
|
# jiu's Flutter-web + version.yaml swap entirely: pangolin's client has no
|
|
# web build in this pipeline, and no version.yaml self-update manifest.
|
|
#
|
|
# TODO(controller): this script assumes pangolin-server (or nginx/whatever
|
|
# fronts pangolin1's public HTTP) serves ${DOWNLOADS_DIR} at /downloads/ —
|
|
# that vhost/route wiring is a SEPARATE, not-yet-done task (same status as
|
|
# docs/superpowers/plans/2026-07-05-cicd.md Task 8's "官网下载链接接
|
|
# Android release", which is also not part of this draft).
|
|
#
|
|
# Usage: scripts/ci/deploy-client.sh <tag> (e.g. client-v1.0.49)
|
|
# Requires env: DEPLOY_SSH_KEY (see lib-ssh.sh). Assumes compile-android.sh /
|
|
# compile-windows.sh (or a prior download-artifact step) have already
|
|
# produced dist/pangolin-android.apk and/or dist/pangolin-windows-x64-setup.exe.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=scripts/ci/lib-ssh.sh
|
|
. "${SCRIPT_DIR}/lib-ssh.sh"
|
|
|
|
# TODO(controller): confirm this path. Proposed to sit alongside the existing
|
|
# /var/lib/pangolin/ tree (pangolin.db lives at /var/lib/pangolin/pangolin.db
|
|
# per deploy-server.sh) rather than under nginx's webroot directly, so the
|
|
# web server config just needs one `location /downloads/ { alias ...; }`
|
|
# (or equivalent) added — no file ownership overlap with the control-plane
|
|
# SQLite DB / systemd units.
|
|
DOWNLOADS_DIR=/var/lib/pangolin/downloads
|
|
|
|
TAG="${1:?usage: deploy-client.sh <tag>}"
|
|
|
|
# Refuse anything that isn't a strict client-vX.Y.Z[-suffix] tag before it can
|
|
# reach the remote commands below (command-injection guard, mirroring
|
|
# deploy-server.sh's rationale: an anchored regex, not a `case` glob, since a
|
|
# trailing `*` would match shell metacharacters too).
|
|
if ! [[ "$TAG" =~ ^client-v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.]+)?$ ]]; then
|
|
echo "deploy-client: refusing unexpected tag '$TAG'" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f dist/pangolin-android.apk ] && [ ! -f dist/pangolin-windows-x64-setup.exe ]; then
|
|
echo "deploy-client: no artifacts found in dist/ — nothing to deploy" >&2
|
|
exit 1
|
|
fi
|
|
|
|
setup_ssh
|
|
SCP="scp -i ${SSH_KEY_FILE} -P ${DEPLOY_PORT} -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=${SSH_KNOWN_HOSTS_FILE}"
|
|
|
|
echo "==> deploy-client: tag=${TAG} host=${DEPLOY_HOST} downloads_dir=${DOWNLOADS_DIR}"
|
|
$SSH "root@${DEPLOY_HOST}" "mkdir -p ${DOWNLOADS_DIR}"
|
|
|
|
if [ -f dist/pangolin-android.apk ]; then
|
|
echo "==> deploy-client: uploading pangolin-android.apk"
|
|
$SCP dist/pangolin-android.apk "root@${DEPLOY_HOST}:/tmp/pangolin-android.apk.new"
|
|
$SSH "root@${DEPLOY_HOST}" "rm -f ${DOWNLOADS_DIR}/pangolin-android.apk && mv /tmp/pangolin-android.apk.new ${DOWNLOADS_DIR}/pangolin-android.apk && chmod 644 ${DOWNLOADS_DIR}/pangolin-android.apk"
|
|
fi
|
|
|
|
if [ -f dist/pangolin-windows-x64-setup.exe ]; then
|
|
echo "==> deploy-client: uploading pangolin-windows-x64-setup.exe"
|
|
$SCP dist/pangolin-windows-x64-setup.exe "root@${DEPLOY_HOST}:/tmp/pangolin-windows-x64-setup.exe.new"
|
|
$SSH "root@${DEPLOY_HOST}" "rm -f ${DOWNLOADS_DIR}/pangolin-windows-x64-setup.exe && mv /tmp/pangolin-windows-x64-setup.exe.new ${DOWNLOADS_DIR}/pangolin-windows-x64-setup.exe && chmod 644 ${DOWNLOADS_DIR}/pangolin-windows-x64-setup.exe"
|
|
fi
|
|
|
|
# TODO(controller): macOS artifact not yet produced by this draft — add the
|
|
# same guarded upload+swap once compile-macos.sh lands (Phase 3).
|
|
|
|
echo "==> deploy-client: done"
|