Skip to content
Merged

0.1.8 #104

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
3 changes: 2 additions & 1 deletion .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 All @@ -35,4 +36,4 @@ NumberGuessingGame-macos/
NumberGuessingGame-linux/
NumberGuessingGame-windows.zip
NumberGuessingGame-macos.zip
NumberGuessingGame-linux.tar.gz
NumberGuessingGame-linux.tar.xz
44 changes: 42 additions & 2 deletions 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
```
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 All @@ -63,7 +96,7 @@ Download the `archive.zip` from the [latest release](https://github.com/project5

#### Requirements

- Java 8 or higher
- Java 17 or higher

#### How to Run

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
15 changes: 6 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'

//Spotless
id 'application'
id 'com.diffplug.spotless' version '8.1.0'

id 'com.gradleup.shadow' version '9.2.2'
}

repositories {
// Use Maven Central for resolving dependencies.

mavenCentral()
gradlePluginPortal()
google()
}

dependencies {
// This dependency is used by the application.

implementation libs.guava
}

Expand All @@ -25,16 +22,16 @@ testing {
// Configure the built-in test suite
test {
// Use JUnit Jupiter test framework
useJUnitJupiter('5.14.1')
useJUnitJupiter('6.0.1')
}
}
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
// Use JDK 25
languageVersion = JavaLanguageVersion.of(8)

languageVersion = JavaLanguageVersion.of(17)
}
}

Expand Down
2 changes: 1 addition & 1 deletion debian-package/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Version: 1.0.0
Section: games
Priority: optional
Architecture: all
Depends: default-jre | java8-runtime
Depends: default-jre
Maintainer: project516 <project516.progress139@slmail.me>
Description: A simple number guessing game
A simple number guessing game where you try to guess a randomly
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 <138796702+Project516@users.noreply.github.com>
#
# 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-17-openjdk-headless

%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 <138796702+Project516@users.noreply.github.com> - 1.0.0-1
- Initial Fedora package release
2 changes: 1 addition & 1 deletion package-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo "Building Number Guessing Game for Linux with bundled JRE..."
# Configuration
PACKAGE_NAME="NumberGuessingGame-linux"
JRE_DIR="jre-linux"
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/8/ga"
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/17/ga"

# Clean up any previous builds
rm -rf ${PACKAGE_NAME}
Expand Down
2 changes: 1 addition & 1 deletion package-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo "Building Number Guessing Game for macOS with bundled JRE..."
# Configuration
PACKAGE_NAME="NumberGuessingGame-macos"
JRE_DIR="jre-macos"
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/8/ga"
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/17/ga"

# Clean up any previous builds
rm -rf ${PACKAGE_NAME}
Expand Down
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 <138796702+Project516@users.noreply.github.com>
#
# 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 ""
2 changes: 1 addition & 1 deletion package-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo "Building Number Guessing Game for Windows with bundled JRE..."
# Configuration
PACKAGE_NAME="NumberGuessingGame-windows"
JRE_DIR="jre-windows"
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/8/ga"
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/17/ga"

# Clean up any previous builds
rm -rf ${PACKAGE_NAME}
Expand Down
Loading