mirror of
https://git.unlock-music.dev/um/cli.git
synced 2025-05-23 00:26:19 +08:00
ci: simplify packing script logic
This commit is contained in:
parent
c0649d1246
commit
1a943309fa
@ -3,22 +3,27 @@
|
|||||||
|
|
||||||
APP_VERSION="${1:-$(git describe --tags --always)}"
|
APP_VERSION="${1:-$(git describe --tags --always)}"
|
||||||
|
|
||||||
for exe in prepare/*/um-*.exe; do
|
pack() {
|
||||||
name="$(basename "$exe" .exe)-$APP_VERSION"
|
local is_windows=0
|
||||||
new_exe="$(dirname "$exe")/um.exe"
|
local suffix=""
|
||||||
mv "$exe" "$new_exe"
|
if [[ "$1" == *.exe ]]; then
|
||||||
|
suffix=".exe"
|
||||||
|
is_windows=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "archiving ${new_exe}..."
|
local exe_dir="$(dirname "$1")"
|
||||||
zip -Xqj9 "dist/${name}.zip" "$new_exe"
|
local archive_name="$(basename "$1" ".exe")-${APP_VERSION}${suffix}"
|
||||||
rm -f "$new_exe"
|
local exe_name="um${suffix}"
|
||||||
done
|
|
||||||
|
|
||||||
for exe in prepare/*/um-*; do
|
echo "archiving ${exe_name}..."
|
||||||
name="$(basename "$exe")-$APP_VERSION"
|
|
||||||
new_exe="$(dirname "$exe")/um"
|
|
||||||
mv "$exe" "$new_exe"
|
|
||||||
|
|
||||||
echo "archiving ${new_exe}..."
|
# Prepare metadata
|
||||||
|
cp README.md LICENSE "$exe_dir"
|
||||||
|
mv "$1" "${exe_dir}/${exe_name}"
|
||||||
|
|
||||||
|
if [[ "$is_windows" == 1 ]]; then
|
||||||
|
zip -Xqj9 "dist/${archive_name}.zip" "${exe_name}" README.md LICENSE
|
||||||
|
else
|
||||||
tar \
|
tar \
|
||||||
--sort=name --format=posix \
|
--sort=name --format=posix \
|
||||||
--pax-option=exthdr.name=%d/PaxHeaders/%f \
|
--pax-option=exthdr.name=%d/PaxHeaders/%f \
|
||||||
@ -26,9 +31,14 @@ for exe in prepare/*/um-*; do
|
|||||||
--clamp-mtime --mtime='1970-01-01T00:00:00Z' \
|
--clamp-mtime --mtime='1970-01-01T00:00:00Z' \
|
||||||
--numeric-owner --owner=0 --group=0 \
|
--numeric-owner --owner=0 --group=0 \
|
||||||
--mode=0755 \
|
--mode=0755 \
|
||||||
-c -C "$(dirname "$exe")" um |
|
-c -C "$exe_dir" "${exe_name}" README.md LICENSE |
|
||||||
gzip -9 >"dist/${name}.tar.gz"
|
gzip -9 >"dist/${archive_name}.tar.gz"
|
||||||
rm -f "$exe"
|
fi
|
||||||
|
rm -rf "$exe_dir"
|
||||||
|
}
|
||||||
|
|
||||||
|
for exe in prepare/*/um*; do
|
||||||
|
pack "$exe"
|
||||||
done
|
done
|
||||||
|
|
||||||
pushd dist
|
pushd dist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user