Skip to content

Commit

Permalink
Add support for .tar.gz packaging
Browse files Browse the repository at this point in the history
Make package_client.sh accept an archive format.

PR #5515 <#5515>
  • Loading branch information
rom1v committed Nov 24, 2024
1 parent 179c664 commit 93da693
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
tar xf dist-tar/dist.tar.gz
- name: Package win32
run: release/package_client.sh win32
run: release/package_client.sh win32 zip

- name: Upload win32 release
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
tar xf dist-tar/dist.tar.gz
- name: Package win64
run: release/package_client.sh win64
run: release/package_client.sh win64 zip

- name: Upload win64 release
uses: actions/upload-artifact@v4
Expand Down
30 changes: 25 additions & 5 deletions release/package_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ cd "$(dirname ${BASH_SOURCE[0]})"
. build_common
cd .. # root project dir

if [[ $# != 1 ]]
if [[ $# != 2 ]]
then
# <target_name>: for example win64
echo "Syntax: $0 <target>" >&2
# <format>: zip or tar.gz
echo "Syntax: $0 <target> <format>" >&2
exit 1
fi

FORMAT=$2

if [[ "$2" != zip && "$2" != tar.gz ]]
then
echo "Invalid format (expected zip or tar.gz): $2" >&2
exit 1
fi

BUILD_DIR="$WORK_DIR/build-$1"
Expand All @@ -25,8 +33,20 @@ cp "$WORK_DIR/build-server/server/scrcpy-server" "$ARCHIVE_DIR/$TARGET/"
mkdir -p "$OUTPUT_DIR"

cd "$ARCHIVE_DIR"
rm -f "$OUTPUT_DIR/$TARGET.zip"
zip -r "$OUTPUT_DIR/$TARGET.zip" "$TARGET"
rm -f "$OUTPUT_DIR/$TARGET.$FORMAT"

case "$FORMAT" in
zip)
zip -r "$OUTPUT_DIR/$TARGET.zip" "$TARGET"
;;
tar.gz)
tar cvf "$OUTPUT_DIR/$TARGET.tar.gz" "$TARGET"
;;
*)
echo "Invalid format (expected zip or tar.gz): $FORMAT" >&2
exit 1
esac

rm -rf "$TARGET"
cd -
echo "Generated '$OUTPUT_DIR/$TARGET.zip'"
echo "Generated '$OUTPUT_DIR/$TARGET.$FORMAT'"
4 changes: 2 additions & 2 deletions release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ rm -rf output
./build_windows.sh 64

./package_server.sh
./package_client.sh win32
./package_client.sh win64
./package_client.sh win32 zip
./package_client.sh win64 zip

./generate_checksums.sh

Expand Down

0 comments on commit 93da693

Please sign in to comment.