Skip to content

Commit 4a19def

Browse files
authored
Merge pull request #88 from Project516/copilot/compress-releases-for-size
Improve release compression for smaller downloads
2 parents fd43ff8 + d35c5ae commit 4a19def

7 files changed

Lines changed: 17 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ jobs:
5050
./archive.zip
5151
./NumberGuessingGame-windows.zip
5252
./NumberGuessingGame-macos.zip
53-
./NumberGuessingGame-linux.tar.gz
53+
./NumberGuessingGame-linux.tar.xz

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Download the platform-specific package with bundled JRE from the [latest release
4747

4848
- **Windows**: `NumberGuessingGame-windows.zip` (no Java installation required)
4949
- **macOS**: `NumberGuessingGame-macos.zip` (no Java installation required)
50-
- **Linux**: `NumberGuessingGame-linux.tar.gz` (no Java installation required)
50+
- **Linux**: `NumberGuessingGame-linux.tar.xz` (no Java installation required)
5151

5252
Extract the downloaded archive and run:
5353

@@ -183,7 +183,7 @@ Run the following scripts to create platform-specific packages with bundled JRE:
183183
```bash
184184
./package-win.sh # Creates NumberGuessingGame-windows.zip
185185
./package-macos.sh # Creates NumberGuessingGame-macos.zip
186-
./package-linux.sh # Creates NumberGuessingGame-linux.tar.gz
186+
./package-linux.sh # Creates NumberGuessingGame-linux.tar.xz
187187
```
188188

189189
These packages include a bundled JRE and do not require Java to be installed on the target system. They are automatically built and uploaded to GitHub Releases via GitHub Actions.

package-linux.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
# Script to create a Linux package with bundled JRE for Number Guessing Game
33
# This creates a self-contained package that doesn't require Java to be installed
4-
# Output: NumberGuessingGame-linux.tar.gz
4+
# Output: NumberGuessingGame-linux.tar.xz
55

66
# Exit immediately if any command fails
77
set -e
@@ -16,6 +16,7 @@ ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/8/ga"
1616
# Clean up any previous builds
1717
rm -rf ${PACKAGE_NAME}
1818
rm -rf ${JRE_DIR}
19+
rm -f ${PACKAGE_NAME}.tar.xz
1920
rm -f ${PACKAGE_NAME}.tar.gz
2021

2122
# Build the application using Gradle
@@ -58,14 +59,14 @@ EOF
5859
# Make the run script executable
5960
chmod +x ${PACKAGE_NAME}/run.sh
6061

61-
# Create the final tar.gz archive
62-
echo "Creating tar.gz archive..."
63-
tar -czf ${PACKAGE_NAME}.tar.gz ${PACKAGE_NAME}/
62+
# Create the final tar.xz archive with maximum compression
63+
echo "Creating tar.xz archive..."
64+
tar -cJf ${PACKAGE_NAME}.tar.xz ${PACKAGE_NAME}/
6465

6566
# Clean up temporary directories
6667
rm -rf ${PACKAGE_NAME}
6768
rm -rf ${JRE_DIR}
6869

6970
echo ""
70-
echo "✓ Linux package with bundled JRE created: ${PACKAGE_NAME}.tar.gz"
71+
echo "✓ Linux package with bundled JRE created: ${PACKAGE_NAME}.tar.xz"
7172
echo ""

package-macos.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ EOF
5858
# Make the run script executable
5959
chmod +x ${PACKAGE_NAME}/run.sh
6060

61-
# Create the final zip archive
61+
# Create the final zip archive with maximum compression
6262
echo "Creating zip archive..."
63-
zip -r ${PACKAGE_NAME}.zip ${PACKAGE_NAME}/
63+
zip -9 -r ${PACKAGE_NAME}.zip ${PACKAGE_NAME}/
6464

6565
# Clean up temporary directories
6666
rm -rf ${PACKAGE_NAME}

package-win.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ jre\bin\java.exe -jar game.jar
5454
@pause
5555
EOF
5656

57-
# Create the final zip archive
57+
# Create the final zip archive with maximum compression
5858
echo "Creating zip archive..."
59-
zip -r ${PACKAGE_NAME}.zip ${PACKAGE_NAME}/
59+
zip -9 -r ${PACKAGE_NAME}.zip ${PACKAGE_NAME}/
6060

6161
# Clean up temporary directories
6262
rm -rf ${PACKAGE_NAME}

package-zip.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ copy scripts\run.sh NumberGuessingGame\run.sh
1717
copy README.md NumberGuessingGame\README.txt
1818
copy LICENSE NumberGuessingGame\LICENSE
1919

20-
REM Create the ZIP archive using PowerShell
21-
powershell -command "Compress-Archive -Path NumberGuessingGame -DestinationPath archive.zip -Force"
20+
REM Create the ZIP archive using PowerShell with maximum compression
21+
powershell -command "Compress-Archive -Path NumberGuessingGame -DestinationPath archive.zip -CompressionLevel Optimal -Force"
2222

2323
REM Clean up temporary directory
2424
rmdir /s /q NumberGuessingGame

package-zip.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ cp -r scripts/run.sh NumberGuessingGame/run.sh
2222
cp -r README.md NumberGuessingGame/README.txt
2323
cp -r LICENSE NumberGuessingGame/LICENSE
2424

25-
# Create the ZIP archive
26-
zip -r archive.zip NumberGuessingGame/
25+
# Create the ZIP archive with maximum compression
26+
zip -9 -r archive.zip NumberGuessingGame/
2727

2828
# Clean up temporary directory
2929
rm -rf NumberGuessingGame

0 commit comments

Comments
 (0)