Write an update archive with only the files changed since the last publish
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+27
-7
@@ -5,7 +5,9 @@
|
||||
# files, so the second publish only adds what the first lacks. The target
|
||||
# machine needs no .NET install. Use publish-windows.sh or publish-linux.sh, or
|
||||
# pass the runtime id, for example win-arm64 (the bridge and XMMT.ocx are 32
|
||||
# bit x86 either way).
|
||||
# bit x86 either way). When an archive from an earlier run exists, a second
|
||||
# archive, dist/nonemm-<rid>-update, holds only the files that are new or
|
||||
# changed since then, for unpacking over the old install.
|
||||
rid="${1:?usage: publish.sh <runtime id>}"
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
name="nonemm-$rid"
|
||||
@@ -13,20 +15,38 @@ out="dist/$name"
|
||||
mkdir -p dist
|
||||
rm -rf "$out"
|
||||
|
||||
case "$rid" in
|
||||
win-*) extension=zip ;;
|
||||
*) extension=tar.gz ;;
|
||||
esac
|
||||
archive="dist/$name.$extension"
|
||||
update="dist/$name-update.$extension"
|
||||
|
||||
# the full archive is replaced below, so keep the old one to compare against
|
||||
previous=""
|
||||
if [ -f "$archive" ]; then
|
||||
previous="dist/$name.previous.$extension"
|
||||
cp "$archive" "$previous" || exit 1
|
||||
fi
|
||||
|
||||
for project in Nonemm.App Nonemm.Recorder.App; do
|
||||
./build.sh publish "src/$project" -c Release -r "$rid" --self-contained -o "$out" || exit 1
|
||||
done
|
||||
rm -f "$out"/*.pdb
|
||||
|
||||
case "$rid" in
|
||||
win-*)
|
||||
rm -f "dist/$name.zip"
|
||||
case "$extension" in
|
||||
zip)
|
||||
python3 -c 'import shutil, sys; shutil.make_archive(sys.argv[1], "zip", "dist", sys.argv[2])' \
|
||||
"$out" "$name" || exit 1
|
||||
echo "dist/$name.zip"
|
||||
;;
|
||||
*)
|
||||
tar -C dist -czf "dist/$name.tar.gz" "$name" || exit 1
|
||||
echo "dist/$name.tar.gz"
|
||||
tar -C dist -czf "$archive" "$name" || exit 1
|
||||
;;
|
||||
esac
|
||||
echo "$archive"
|
||||
|
||||
rm -f "$update"
|
||||
if [ -n "$previous" ]; then
|
||||
python3 "$(dirname "$0")/publish-update.py" "$previous" "$out" "$update" || exit 1
|
||||
rm -f "$previous"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user