Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 60 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,41 @@ on:
types: [created]

jobs:
build-and-upload:
build-assets:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: true
matrix:
target:
- name: jar
command: ./gradlew build && cp app/build/libs/app-all.jar NumberGuessingGame.jar
artifact: NumberGuessingGame.jar
path: ./NumberGuessingGame.jar
- name: deb
command: ./package-deb.sh
artifact: NumberGuessingGame.deb
path: ./NumberGuessingGame.deb
- name: rpm
command: ./package-rpm.sh
artifact: NumberGuessingGame.rpm
path: ./NumberGuessingGame.rpm
needsRpmTools: true
- name: zip
command: ./package-zip.sh
artifact: NumberGuessingGame-archive.zip
path: ./NumberGuessingGame-archive.zip
- name: windows
command: ./package-win.sh
artifact: NumberGuessingGame-windows.zip
path: ./NumberGuessingGame-windows.zip
- name: macos
command: ./package-macos.sh
artifact: NumberGuessingGame-macos.zip
path: ./NumberGuessingGame-macos.zip
- name: linux
command: ./package-linux.sh
artifact: NumberGuessingGame-linux.tar.xz
path: ./NumberGuessingGame-linux.tar.xz

steps:
- name: Checkout code
Expand All @@ -27,38 +58,40 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5

- name: Build JAR with Gradle
run: ./gradlew build

- name: Build Debian package
run: ./package-deb.sh

- name: Install RPM build tools
if: ${{ matrix.target.needsRpmTools }}
run: sudo apt-get update && sudo apt-get install -y rpm

- name: Build Fedora/RPM package
run: ./package-rpm.sh

- name: Build ZIP archive
run: ./package-zip.sh
- name: Build ${{ matrix.target.name }}
run: ${{ matrix.target.command }}

- name: Build Windows package with bundled JRE
run: ./package-win.sh
- name: Upload ${{ matrix.target.name }} artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.artifact }}
path: ${{ matrix.target.path }}
if-no-files-found: error

- name: Build macOS package with bundled JRE
run: ./package-macos.sh
create-release:
runs-on: ubuntu-latest
needs: build-assets
permissions:
contents: write

- name: Build Linux package with bundled JRE
run: ./package-linux.sh
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
./app/build/libs/app-all.jar
./numberguessinggame.deb
./numberguessinggame.rpm
./archive.zip
./NumberGuessingGame-windows.zip
./NumberGuessingGame-macos.zip
./NumberGuessingGame-linux.tar.xz
dist/NumberGuessingGame.jar/NumberGuessingGame.jar
dist/NumberGuessingGame.deb/NumberGuessingGame.deb
dist/NumberGuessingGame.rpm/NumberGuessingGame.rpm
dist/NumberGuessingGame-archive.zip/NumberGuessingGame-archive.zip
dist/NumberGuessingGame-windows.zip/NumberGuessingGame-windows.zip
dist/NumberGuessingGame-macos.zip/NumberGuessingGame-macos.zip
dist/NumberGuessingGame-linux.tar.xz/NumberGuessingGame-linux.tar.xz
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ gradle-app.setting
# Ignore Gradle build output directory
build

archive.zip
numberguessinggame.deb
numberguessinggame-*.rpm

# JRE bundling artifacts
jre-windows/
jre-macos/
jre-linux/

# Unzipped artifacts
NumberGuessingGame-windows/
NumberGuessingGame-macos/
NumberGuessingGame-linux/

# Packaged artifacts
NumberGuessingGame-windows.zip
NumberGuessingGame-macos.zip
NumberGuessingGame-linux.tar.xz
numberguessinggame.rpm
NumberGuessingGame.rpm
NumberGuessingGame.deb
NumberGuessingGame.jar
12 changes: 6 additions & 6 deletions package-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Script to create a Debian package (.deb) for Number Guessing Game
# This package can be installed on Debian-based Linux distributions (Ubuntu, Mint, etc.)
# Usage: ./package-deb.sh
# Output: numberguessinggame.deb
# Output: NumberGuessingGame.deb

# Exit immediately if any command fails
set -e
Expand All @@ -17,7 +17,7 @@ echo "Building Number Guessing Game Debian package..."
# Clean up any previous build artifacts
echo "Cleaning up previous builds..."
rm -rf debian-package/usr/share/games/numberguessinggame/*
rm -f numberguessinggame.deb
rm -f NumberGuessingGame.deb

# Build the application using Gradle
echo "Building application..."
Expand All @@ -40,16 +40,16 @@ chmod 755 debian-package/usr/games/numberguessinggame

# Build the .deb package using dpkg-deb
echo "Building .deb package..."
dpkg-deb --build debian-package numberguessinggame.deb
dpkg-deb --build debian-package NumberGuessingGame.deb

# Display success message with installation instructions
echo ""
echo "✓ Debian package created: numberguessinggame.deb"
echo "✓ Debian package created: NumberGuessingGame.deb"
echo ""
echo "To install, run:"
echo " sudo apt install ./numberguessinggame.deb"
echo " sudo apt install ./NumberGuessingGame.deb"
echo " sudo apt install -f # to install any missing dependencies"
echo ""
echo "After installation, run the game with:"
echo " numberguessinggame"
echo ""
echo ""
14 changes: 7 additions & 7 deletions package-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Script to create a Fedora/RPM package (.rpm) for Number Guessing Game
# This package can be installed on Fedora, RHEL, CentOS, and other RPM-based distributions
# Usage: ./package-rpm.sh
# Output: numberguessinggame-1.0.0-1.noarch.rpm
# Output: NumberGuessingGame.rpm

# Exit immediately if any command fails
set -e
Expand All @@ -27,7 +27,7 @@ echo "Cleaning up previous builds..."
rm -rf ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm
rm -rf ~/rpmbuild/BUILD/numberguessinggame-*
rm -rf ~/rpmbuild/BUILDROOT/numberguessinggame-*
rm -f numberguessinggame.rpm
rm -f NumberGuessingGame.rpm

# Build the application using Gradle
echo "Building application..."
Expand Down Expand Up @@ -55,18 +55,18 @@ rpmbuild -bb ~/rpmbuild/SPECS/numberguessinggame.spec

# Copy the built RPM to the current directory
echo "Copying RPM package to current directory..."
cp ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm ./numberguessinggame.rpm
cp ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm ./NumberGuessingGame.rpm

# Display success message with installation instructions
echo ""
echo "✓ RPM package created: $(ls numberguessinggame.rpm)"
echo "✓ RPM package created: $(ls NumberGuessingGame.rpm)"
echo ""
echo "To install on Fedora/RHEL/CentOS, run:"
echo " sudo dnf install ./numberguessinggame.rpm"
echo " sudo dnf install ./NumberGuessingGame.rpm"
echo ""
echo "Or on older systems:"
echo " sudo yum install ./numberguessinggame.rpm"
echo " sudo yum install ./NumberGuessingGame.rpm"
echo ""
echo "After installation, run the game with:"
echo " numberguessinggame"
echo ""
echo ""
6 changes: 3 additions & 3 deletions package-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Clean up any previous builds
rm -rf NumberGuessingGame
rm -rf temp
rm -f archive.zip
rm -f NumberGuessingGame-archive.zip

# Build the application
cd app
Expand All @@ -28,7 +28,7 @@ cp -r README.md NumberGuessingGame/README.txt
cp -r LICENSE NumberGuessingGame/LICENSE

# Create the ZIP archive with maximum compression
zip -9 -r archive.zip NumberGuessingGame/
zip -9 -r NumberGuessingGame-archive.zip NumberGuessingGame/

# Clean up temporary directory
rm -rf NumberGuessingGame
rm -rf NumberGuessingGame
Loading