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
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
- name: Build Debian package
run: ./package-deb.sh

- name: Install RPM build tools
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

Expand All @@ -47,6 +53,7 @@ jobs:
files: |
./app/build/libs/app-all.jar
./numberguessinggame.deb
./numberguessinggame-*.rpm
./archive.zip
./NumberGuessingGame-windows.zip
./NumberGuessingGame-macos.zip
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ build

archive.zip
numberguessinggame.deb
numberguessinggame-*.rpm

# JRE bundling artifacts
jre-windows/
Expand Down
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For Debian/Ubuntu and derivatives (recommended for terminal usage):

You can use curl to do it from the command line:
```bash
curl -s -L -o numberguessingame.deb https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame.deb
curl -s -L -o numberguessinggame.deb https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame.deb
```
where `x` and `y` is the version you want.
2. Install it:
Expand All @@ -41,6 +41,39 @@ sudo apt remove numberguessinggame
sudo apt autoremove -y # Remove dependencies
```

### Installation via Fedora/RPM Package (DNF/YUM)

For Fedora, RHEL, CentOS, and other RPM-based distributions:

1. Download the `.rpm` package from the [latest release](https://github.com/Project516/NumberGuessingGame/releases)

You can use curl to do it from the command line:
```bash
curl -s -L -o numberguessinggame.rpm https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame-1.0.0-1.noarch.rpm
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The download URL includes a hardcoded version "1.0.0-1" in the filename (numberguessinggame-1.0.0-1.noarch.rpm), but uses a placeholder 0.x.y for the release tag. This is inconsistent with the DEB instructions (line 22) which only use placeholders. For consistency and to avoid confusion, consider using a placeholder pattern like numberguessinggame-*.rpm or numberguessinggame-1.0.0-1.noarch.rpm with a matching release tag placeholder.

Suggested change
curl -s -L -o numberguessinggame.rpm https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame-1.0.0-1.noarch.rpm
curl -s -L -o numberguessinggame-*.rpm https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame-*.rpm

Copilot uses AI. Check for mistakes.
```
where `x` and `y` is the version you want.
2. Install it:
```bash
sudo dnf install ./numberguessinggame-*.rpm
```
Or on older systems:
```bash
sudo yum install ./numberguessinggame-*.rpm
```
3. Run from anywhere in your terminal:
```bash
numberguessinggame
```

To uninstall:
```bash
sudo dnf remove numberguessinggame
```
Or on older systems:
```bash
sudo yum remove numberguessinggame
```

### Standalone Packages with Bundled JRE (Recommended)

Download the platform-specific package with bundled JRE from the [latest release](https://github.com/project516/numberguessinggame/releases):
Expand Down Expand Up @@ -167,6 +200,13 @@ Run `./package-deb.sh` from the project root.

This will create `numberguessinggame.deb` which can be installed via `apt`/`dpkg` on Debian-based systems. The package can be released to GitHub Releases for easy distribution.

#### Fedora/RPM Package

**On Linux (requires rpm-build):**
Run `./package-rpm.sh` from the project root.

This will create `numberguessinggame-1.0.0-1.noarch.rpm` which can be installed via `dnf`/`yum`/`rpm` on Fedora, RHEL, CentOS, and other RPM-based systems. The package can be released to GitHub Releases for easy distribution.

#### Platform-Specific Packages with Bundled JRE

**On Linux:**
Expand Down
4 changes: 4 additions & 0 deletions fedora-package/SOURCES/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore all build artifacts in this directory
*
# But keep this .gitignore file
!.gitignore
54 changes: 54 additions & 0 deletions fedora-package/SPECS/numberguessinggame.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-FileCopyrightText: 2025 Project516 <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later

Name: numberguessinggame
Version: 1.0.0
Release: 1%{?dist}
Summary: A simple number guessing game

License: GPL-3.0-or-later
URL: https://github.com/Project516/NumberGuessingGame
Source0: game.jar

BuildArch: noarch
Requires: java-1.8.0-openjdk-headless
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency java-1.8.0-openjdk-headless is very specific and may not be available on all RPM-based distributions. Consider using a more flexible requirement like Requires: java-headless >= 1:1.8.0 or Requires: jre-headless >= 1.8.0 to allow any Java 8+ JRE implementation, similar to how the Debian package uses default-jre | java8-runtime.

Suggested change
Requires: java-1.8.0-openjdk-headless
Requires: java-headless >= 1:1.8.0

Copilot uses AI. Check for mistakes.

%description
A simple number guessing game where you try to guess a randomly
generated number. The game features both a user-friendly graphical
user interface (GUI) and a classic console mode. High scores are
tracked and stored persistently.

%prep
# No prep needed for prebuilt JAR

%build
# No build needed for prebuilt JAR

%install
rm -rf %{buildroot}

# Create directories
mkdir -p %{buildroot}%{_datadir}/games/%{name}
mkdir -p %{buildroot}%{_bindir}

# Install JAR file
install -m 644 %{SOURCE0} %{buildroot}%{_datadir}/games/%{name}/game.jar

# Create wrapper script
cat > %{buildroot}%{_bindir}/%{name} <<'EOF'
#!/bin/sh
# Wrapper script to launch Number Guessing Game
java -jar %{_datadir}/games/%{name}/game.jar "$@"
EOF

chmod 755 %{buildroot}%{_bindir}/%{name}

%files
%{_bindir}/%{name}
%{_datadir}/games/%{name}/game.jar

%changelog
* Tue Dec 03 2024 Project516 <[email protected]> - 1.0.0-1
- Initial Fedora package release
72 changes: 72 additions & 0 deletions package-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

# SPDX-FileCopyrightText: 2025 Project516 <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later

# 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

# Exit immediately if any command fails
set -e

echo "Building Number Guessing Game RPM package..."

# Check if rpmbuild is installed
if ! command -v rpmbuild >/dev/null 2>&1; then
echo "Error: rpmbuild not found. Please install rpm-build:"
echo " Fedora/RHEL: sudo dnf install rpm-build"
echo " Ubuntu/Debian: sudo apt install rpm"
exit 1
fi

# Clean up any previous build artifacts
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

# Build the application using Gradle
echo "Building application..."
./gradlew build

# Create RPM build directory structure
echo "Setting up RPM build environment..."
mkdir -p ~/rpmbuild/BUILD
mkdir -p ~/rpmbuild/RPMS
mkdir -p ~/rpmbuild/SOURCES
mkdir -p ~/rpmbuild/SPECS
mkdir -p ~/rpmbuild/SRPMS

# Copy the spec file to the SPECS directory
echo "Copying spec file..."
cp fedora-package/SPECS/numberguessinggame.spec ~/rpmbuild/SPECS/numberguessinggame.spec

# Copy the JAR file to the SOURCES directory
echo "Copying JAR file..."
cp app/build/libs/app-all.jar ~/rpmbuild/SOURCES/game.jar

# Build the RPM package
echo "Building RPM package..."
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 .

# Display success message with installation instructions
echo ""
echo "✓ RPM package created: $(ls numberguessinggame-*.rpm)"
echo ""
echo "To install on Fedora/RHEL/CentOS, run:"
echo " sudo dnf install ./numberguessinggame-*.rpm"
echo ""
echo "Or on older systems:"
echo " sudo yum install ./numberguessinggame-*.rpm"
echo ""
echo "After installation, run the game with:"
echo " numberguessinggame"
echo ""
Loading