Skip to content

Commit f85e578

Browse files
committed
Merge branch 'master' into release
2 parents b0712fc + 7b72c00 commit f85e578

File tree

11 files changed

+191
-16
lines changed

11 files changed

+191
-16
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ jobs:
2929
- name: Build Debian package
3030
run: ./package-deb.sh
3131

32+
- name: Install RPM build tools
33+
run: sudo apt-get update && sudo apt-get install -y rpm
34+
35+
- name: Build Fedora/RPM package
36+
run: ./package-rpm.sh
37+
3238
- name: Build ZIP archive
3339
run: ./package-zip.sh
3440

@@ -47,6 +53,7 @@ jobs:
4753
files: |
4854
./app/build/libs/app-all.jar
4955
./numberguessinggame.deb
56+
./numberguessinggame-*.rpm
5057
./archive.zip
5158
./NumberGuessingGame-windows.zip
5259
./NumberGuessingGame-macos.zip

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ build
2525

2626
archive.zip
2727
numberguessinggame.deb
28+
numberguessinggame-*.rpm
2829

2930
# JRE bundling artifacts
3031
jre-windows/
@@ -35,4 +36,4 @@ NumberGuessingGame-macos/
3536
NumberGuessingGame-linux/
3637
NumberGuessingGame-windows.zip
3738
NumberGuessingGame-macos.zip
38-
NumberGuessingGame-linux.tar.gz
39+
NumberGuessingGame-linux.tar.xz

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For Debian/Ubuntu and derivatives (recommended for terminal usage):
1919

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

44+
### Installation via Fedora/RPM Package (DNF/YUM)
45+
46+
For Fedora, RHEL, CentOS, and other RPM-based distributions:
47+
48+
1. Download the `.rpm` package from the [latest release](https://github.com/Project516/NumberGuessingGame/releases)
49+
50+
You can use curl to do it from the command line:
51+
```bash
52+
curl -s -L -o numberguessinggame.rpm https://github.com/Project516/NumberGuessingGame/releases/download/0.x.y/numberguessinggame-1.0.0-1.noarch.rpm
53+
```
54+
where `x` and `y` is the version you want.
55+
2. Install it:
56+
```bash
57+
sudo dnf install ./numberguessinggame-*.rpm
58+
```
59+
Or on older systems:
60+
```bash
61+
sudo yum install ./numberguessinggame-*.rpm
62+
```
63+
3. Run from anywhere in your terminal:
64+
```bash
65+
numberguessinggame
66+
```
67+
68+
To uninstall:
69+
```bash
70+
sudo dnf remove numberguessinggame
71+
```
72+
Or on older systems:
73+
```bash
74+
sudo yum remove numberguessinggame
75+
```
76+
4477
### Standalone Packages with Bundled JRE (Recommended)
4578

4679
Download the platform-specific package with bundled JRE from the [latest release](https://github.com/project516/numberguessinggame/releases):
@@ -63,7 +96,7 @@ Download the `archive.zip` from the [latest release](https://github.com/project5
6396

6497
#### Requirements
6598

66-
- Java 8 or higher
99+
- Java 17 or higher
67100

68101
#### How to Run
69102

@@ -167,6 +200,13 @@ Run `./package-deb.sh` from the project root.
167200

168201
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.
169202

203+
#### Fedora/RPM Package
204+
205+
**On Linux (requires rpm-build):**
206+
Run `./package-rpm.sh` from the project root.
207+
208+
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.
209+
170210
#### Platform-Specific Packages with Bundled JRE
171211

172212
**On Linux:**

app/build.gradle

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
plugins {
2-
// Apply the application plugin to add support for building a CLI application in Java.
3-
id 'application'
42

5-
//Spotless
3+
id 'application'
64
id 'com.diffplug.spotless' version '8.1.0'
7-
85
id 'com.gradleup.shadow' version '9.2.2'
96
}
107

118
repositories {
12-
// Use Maven Central for resolving dependencies.
9+
1310
mavenCentral()
1411
gradlePluginPortal()
1512
google()
1613
}
1714

1815
dependencies {
19-
// This dependency is used by the application.
16+
2017
implementation libs.guava
2118
}
2219

@@ -25,16 +22,16 @@ testing {
2522
// Configure the built-in test suite
2623
test {
2724
// Use JUnit Jupiter test framework
28-
useJUnitJupiter('5.14.1')
25+
useJUnitJupiter('6.0.1')
2926
}
3027
}
3128
}
3229

3330
// Apply a specific Java toolchain to ease working on different environments.
3431
java {
3532
toolchain {
36-
// Use JDK 25
37-
languageVersion = JavaLanguageVersion.of(8)
33+
34+
languageVersion = JavaLanguageVersion.of(17)
3835
}
3936
}
4037

debian-package/DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Version: 0.1.7
33
Section: games
44
Priority: optional
55
Architecture: all
6-
Depends: default-jre | java8-runtime
6+
Depends: default-jre
77
Maintainer: project516 <project516.progress139@slmail.me>
88
Description: A simple number guessing game
99
A simple number guessing game where you try to guess a randomly

fedora-package/SOURCES/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore all build artifacts in this directory
2+
*
3+
# But keep this .gitignore file
4+
!.gitignore
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SPDX-FileCopyrightText: 2025 Project516 <138796702+Project516@users.noreply.github.com>
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
Name: numberguessinggame
6+
Version: 1.0.0
7+
Release: 1%{?dist}
8+
Summary: A simple number guessing game
9+
10+
License: GPL-3.0-or-later
11+
URL: https://github.com/Project516/NumberGuessingGame
12+
Source0: game.jar
13+
14+
BuildArch: noarch
15+
Requires: java-17-openjdk-headless
16+
17+
%description
18+
A simple number guessing game where you try to guess a randomly
19+
generated number. The game features both a user-friendly graphical
20+
user interface (GUI) and a classic console mode. High scores are
21+
tracked and stored persistently.
22+
23+
%prep
24+
# No prep needed for prebuilt JAR
25+
26+
%build
27+
# No build needed for prebuilt JAR
28+
29+
%install
30+
rm -rf %{buildroot}
31+
32+
# Create directories
33+
mkdir -p %{buildroot}%{_datadir}/games/%{name}
34+
mkdir -p %{buildroot}%{_bindir}
35+
36+
# Install JAR file
37+
install -m 644 %{SOURCE0} %{buildroot}%{_datadir}/games/%{name}/game.jar
38+
39+
# Create wrapper script
40+
cat > %{buildroot}%{_bindir}/%{name} <<'EOF'
41+
#!/bin/sh
42+
# Wrapper script to launch Number Guessing Game
43+
java -jar %{_datadir}/games/%{name}/game.jar "$@"
44+
EOF
45+
46+
chmod 755 %{buildroot}%{_bindir}/%{name}
47+
48+
%files
49+
%{_bindir}/%{name}
50+
%{_datadir}/games/%{name}/game.jar
51+
52+
%changelog
53+
* Tue Dec 03 2024 Project516 <138796702+Project516@users.noreply.github.com> - 1.0.0-1
54+
- Initial Fedora package release

package-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ echo "Building Number Guessing Game for Linux with bundled JRE..."
1616
# Configuration
1717
PACKAGE_NAME="NumberGuessingGame-linux"
1818
JRE_DIR="jre-linux"
19-
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/8/ga"
19+
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/17/ga"
2020

2121
# Clean up any previous builds
2222
rm -rf ${PACKAGE_NAME}

package-macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ echo "Building Number Guessing Game for macOS with bundled JRE..."
1616
# Configuration
1717
PACKAGE_NAME="NumberGuessingGame-macos"
1818
JRE_DIR="jre-macos"
19-
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/8/ga"
19+
ADOPTIUM_BASE_URL="https://api.adoptium.net/v3/binary/latest/17/ga"
2020

2121
# Clean up any previous builds
2222
rm -rf ${PACKAGE_NAME}

package-rpm.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/sh
2+
3+
# SPDX-FileCopyrightText: 2025 Project516 <138796702+Project516@users.noreply.github.com>
4+
#
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
# Script to create a Fedora/RPM package (.rpm) for Number Guessing Game
8+
# This package can be installed on Fedora, RHEL, CentOS, and other RPM-based distributions
9+
# Usage: ./package-rpm.sh
10+
# Output: numberguessinggame-1.0.0-1.noarch.rpm
11+
12+
# Exit immediately if any command fails
13+
set -e
14+
15+
echo "Building Number Guessing Game RPM package..."
16+
17+
# Check if rpmbuild is installed
18+
if ! command -v rpmbuild >/dev/null 2>&1; then
19+
echo "Error: rpmbuild not found. Please install rpm-build:"
20+
echo " Fedora/RHEL: sudo dnf install rpm-build"
21+
echo " Ubuntu/Debian: sudo apt install rpm"
22+
exit 1
23+
fi
24+
25+
# Clean up any previous build artifacts
26+
echo "Cleaning up previous builds..."
27+
rm -rf ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm
28+
rm -rf ~/rpmbuild/BUILD/numberguessinggame-*
29+
rm -rf ~/rpmbuild/BUILDROOT/numberguessinggame-*
30+
rm -f numberguessinggame-*.rpm
31+
32+
# Build the application using Gradle
33+
echo "Building application..."
34+
./gradlew build
35+
36+
# Create RPM build directory structure
37+
echo "Setting up RPM build environment..."
38+
mkdir -p ~/rpmbuild/BUILD
39+
mkdir -p ~/rpmbuild/RPMS
40+
mkdir -p ~/rpmbuild/SOURCES
41+
mkdir -p ~/rpmbuild/SPECS
42+
mkdir -p ~/rpmbuild/SRPMS
43+
44+
# Copy the spec file to the SPECS directory
45+
echo "Copying spec file..."
46+
cp fedora-package/SPECS/numberguessinggame.spec ~/rpmbuild/SPECS/numberguessinggame.spec
47+
48+
# Copy the JAR file to the SOURCES directory
49+
echo "Copying JAR file..."
50+
cp app/build/libs/app-all.jar ~/rpmbuild/SOURCES/game.jar
51+
52+
# Build the RPM package
53+
echo "Building RPM package..."
54+
rpmbuild -bb ~/rpmbuild/SPECS/numberguessinggame.spec
55+
56+
# Copy the built RPM to the current directory
57+
echo "Copying RPM package to current directory..."
58+
cp ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm .
59+
60+
# Display success message with installation instructions
61+
echo ""
62+
echo "✓ RPM package created: $(ls numberguessinggame-*.rpm)"
63+
echo ""
64+
echo "To install on Fedora/RHEL/CentOS, run:"
65+
echo " sudo dnf install ./numberguessinggame-*.rpm"
66+
echo ""
67+
echo "Or on older systems:"
68+
echo " sudo yum install ./numberguessinggame-*.rpm"
69+
echo ""
70+
echo "After installation, run the game with:"
71+
echo " numberguessinggame"
72+
echo ""

0 commit comments

Comments
 (0)