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
130 changes: 50 additions & 80 deletions .github/workflows/gradle_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,8 @@ on:
workflow_dispatch:

jobs:
# build-jar:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: 21
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@v4
# - name: Compile and build classes
# run: ./gradlew classes
# - name: Run code checks
# run: ./gradlew check
# - name: Build JAR
# continue-on-error: false
# run: ./gradlew desktop:dist
# - name: Upload JAR
# continue-on-error: false
# uses: actions/upload-artifact@v4
# with:
# name: Deadlands-JAR
# path: |
# desktop/build/lib/Deadlands.jar
build-win:
runs-on: windows-latest
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
Expand All @@ -49,80 +24,75 @@ jobs:
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with JPackage
- name: Build JAR
continue-on-error: false
run: ./gradlew desktop:jar
- name: Build for Windows
continue-on-error: false
run: ./gradlew desktop:packageWinX64
- name: Build for macOS x86
continue-on-error: false
run: ./gradlew desktop:jpackage
- name: Compress build
run: |
cd desktop/build/jpackage/Deadlands
Compress-Archive -Path * -Destination ../../../../Deadlands-Windows-${{ github.ref_name }}.zip
cd ../../../../
# lol
- name: Rename installer
run: move desktop/build/jpackage/Deadlands-*.msi Deadlands-Windows-Installer-${{ github.ref_name }}.msi
- name: Upload JAR build
run: ./gradlew desktop:packageMacX64
- name: Build for macOS M1
continue-on-error: false
run: ./gradlew desktop:packageMacM1
- name: Build for Linux
continue-on-error: false
run: ./gradlew desktop:packageLinuxX64
- name: Move JAR
run: mv -f desktop/build/libs/Deadlands.jar Deadlands-${{ github.ref_name }}.jar
- name: Move Windows build
run: mv -f desktop/build/construo/dist/*winX64.zip Deadlands-Windows-${{ github.ref_name }}.zip
- name: Move macOS x86 build
run: mv -f desktop/build/construo/dist/*macX64.zip Deadlands-macOS-x64-${{ github.ref_name }}.zip
- name: Move macOS M1 build
run: mv -f desktop/build/construo/dist/*macM1.zip Deadlands-macOS-arm-${{ github.ref_name }}.zip
- name: Move Linux build
run: mv -f desktop/build/construo/dist/*linuxX64.zip Deadlands-Linux-${{ github.ref_name }}.zip
- name: Upload JAR
continue-on-error: false
uses: actions/upload-artifact@v4
with:
name: Deadlands-JAR-${{ github.ref_name }}
path: |
desktop/build/lib/Deadlands.jar
- name: Upload build
Deadlands-${{ github.ref_name }}.jar
- name: Upload Windows build
continue-on-error: false
uses: actions/upload-artifact@v4
with:
name: Deadlands-Windows-${{ github.ref_name }}
path: |
Deadlands-Windows-${{ github.ref_name }}.zip
Deadlands-Windows-Installer-${{ github.ref_name }}.msi

build-mac-intel:
runs-on: macos-13 # intel mac, not silicon
#needs: build-jar
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# - name: Download JAR
# uses: actions/download-artifact@v4
# with:
# name: Deadlands-JAR
- name: Build with JPackage
- name: Upload macOS x64 build
continue-on-error: false
# run: |
# mkdir -p desktop/build/lib
# mv Deadlands.jar desktop/build/lib/Deadlands.jar
# ./gradlew desktop:jpackageImage
run: ./gradlew desktop:jpackage
- name: Rename DMG file
run: mv -f desktop/build/jpackage/*.dmg Deadlands-macOS-${{ github.ref_name }}.dmg
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: Deadlands-macOS-x64-${{ github.ref_name }}
path: |
Deadlands-macOS-x64-${{ github.ref_name }}.zip
- name: Upload macOS M1 build
continue-on-error: false
uses: actions/upload-artifact@v4
with:
name: Deadlands-macOS-${{ github.ref_name }}
name: Deadlands-macOS-arm-${{ github.ref_name }}
path: |
Deadlands-macOS-${{ github.ref_name }}.dmg

release-github:
runs-on: ubuntu-latest
needs:
- build-win
- build-mac-intel
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
Deadlands-macOS-arm-${{ github.ref_name }}.zip
- name: Upload Linux build
continue-on-error: false
uses: actions/upload-artifact@v4
with:
path: artifacts
merge-multiple: true
name: Deadlands-Linux-${{ github.ref_name }}
path: |
Deadlands-Linux-${{ github.ref_name }}.zip
- name: Create draft release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: artifacts/*
files: |
Deadlands-${{ github.ref_name }}.jar
Deadlands-Windows-${{ github.ref_name }}.zip
Deadlands-macOS-x64-${{ github.ref_name }}.zip
Deadlands-macOS-arm-${{ github.ref_name }}.zip
Deadlands-Linux-${{ github.ref_name }}.zip
token: ${{ secrets.RELEASE_TOKEN }}
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
A top-down sandbox RPG game with crafting, fighting, and a little bit of magic!

## Tech stack
* Java 17
* libGDX v1.13.1
- Java 17
- libGDX v1.13.1

## Run locally
Install Java, then:
Expand All @@ -23,24 +23,31 @@ chmod +x gradlew
4. Right click on ```DesktopLauncher.java``` and select ```Run 'DesktopLauncher.main()'```
5. The game will be run, and can now be run by using the 'Run' action in IntelliJ.

### Troubleshooting
On macOS, the game may show an error when it is run by using the IntelliJ 'Run' action. To fit it, edit the build configuration and add ```-XstartOnFirstThread``` to the VM options.
**Note:** On macOS, the game may show an error when it is run by using the IntelliJ 'Run' action. To fit it, edit the build configuration and add ```-XstartOnFirstThread``` to the VM options.

## Building
To build a runnable app binary for the current platform, simply run the ```jpackageImage``` task in Gradle with the following command:
```./gradlew desktop:jpackageImage```
To build a .jar file, run `./gradlew desktop:jar`

To also build an installer for the current platform, use ```jpackage``` instead:
```./gradlew desktop:jpackage```
Java 17 is REQUIRED to package the game; the build tasks will fail otherwise.

To build a runnable app binary, run any of the following commands / Gradle tasks depending on the target operating system:
- `./gradlew desktop:packageWinX64` for Windows 64 bit
- `./gradlew desktop:packageMacX64` for macOS 64 bit
- `./gradlew desktop:packageMacM1` for macOS with Apple Silicon
- `./gradlew desktop:packageLinuxX64` for Linux 64 bit

The output will be placed in `desktop/build/construo/dist`.

## Versioning
When releasing a new version, use the tag format: ```vX.X-X```, where:
* The first X represents the major version. Increment when new gameplay changes are made (i.e. new features)
* The second X represents a patch of the version where minor gameplay changes may be made, without any new features or large gameplay differences (i.e. bug fixes)
* The final X should be either ```alpha```, ```pre```, or omitted altogether for a release version
- The first X represents the major version. Increment when new gameplay changes are made (i.e. new features)
- The second X represents a patch of the version where minor gameplay changes may be made, without any new features or large gameplay differences (i.e. bug fixes)
- The final X should be either ```alpha```, ```pre```, or omitted altogether for a release version

For example: ```v26.3-beta```

- Additionally, if a version is re-released with only runtime changes (changes which do not affect the code of the game itself in any way), it can be tagged by adding a plus and a number to the end of the tag (i.e. `v2.2-pre+1` for the first re-release)

When releasing a new version, remember to change...

- ```VERSION``` in main ```Deadlands.java``` file
Expand Down
101 changes: 52 additions & 49 deletions desktop/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.beryx.runtime" version "1.8.4"
id "io.github.fourlastor.construo" version "2.0.1"
}

sourceSets.main.java.srcDirs = [ "src/" ]
Expand All @@ -11,6 +11,8 @@ def os = System.getProperty("os.name").toLowerCase(Locale.ROOT)
project.ext.mainClassName = "ca.modmonster.deadlands.DesktopLauncher"
project.ext.assetsDir = new File("../assets")


import io.github.fourlastor.construo.Target
import org.gradle.internal.os.OperatingSystem

tasks.register("runGame", JavaExec) {
Expand All @@ -37,9 +39,7 @@ tasks.register("debug", JavaExec) {
setDebug(true)
}

tasks.register("dist", Jar) {
dependsOn("classes")

jar {
archiveFileName.set(jarName)

duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
Expand All @@ -50,55 +50,58 @@ tasks.register("dist", Jar) {
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar

print(layout.buildDirectory)
destinationDirectory = layout.buildDirectory.dir("lib")
}

jpackageImage.dependsOn dist

runtime {
options = [
"--strip-debug",
"--compress", "2",
"--no-header-files",
"--no-man-pages",
"--strip-native-commands",
"--vm", "server"
]

modules = [
"java.base",
"java.desktop",
"jdk.unsupported"
]
// these "exclude" lines remove some unnecessary duplicate files in the output JAR.
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
dependencies {
exclude('META-INF/INDEX.LIST', 'META-INF/maven/**')
}

jpackage {
imageName = appName
installerName = appName
skipInstaller = false
// this last step may help on some OSes that need extra instruction to make runnable JARs.
doLast {
file(archiveFile).setExecutable(true, false)
}
}

appVersion = project.version.toString()
tasks.register("dist", Jar) {
dependsOn("jar")
}

if (os.contains("win")) {
// windows
installerType = "msi"
imageOptions = ["--icon", "icons/icons.ico"]
installerOptions = [
"--win-dir-chooser",
"--win-menu",
"--win-menu-group", "ModMonster",
"--win-shortcut",
"--win-shortcut-prompt"
]
} else if (os.contains("nix") || os.contains("nux") || os.contains("bsd")) {
// linux
imageOptions = ["--icon", "icons/icons.png"]
} else if (os.contains("mac")) {
// mac
installerType = "dmg"
imageOptions = ["--icon", "icons/icons.icns", "--java-options", "\"-XstartOnFirstThread\""]
construo {
// name of the executable
name.set(appName)
// human-readable name, used for example in the `.app` name for macOS
humanName.set(appName)

targets.configure {
register("linuxX64", Target.Linux) {
architecture.set(Target.Architecture.X86_64)
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_linux_hotspot_17.0.15_6.tar.gz")
// Linux does not currently have a way to set the icon on the executable
}
register("macM1", Target.MacOs) {
architecture.set(Target.Architecture.AARCH64)
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.15_6.tar.gz")
// macOS needs an identifier
identifier.set("ca.modmonster." + appName)
// Optional: icon for macOS, as an ICNS file
macIcon.set(project.file("icons/icons.icns"))
}
register("macX64", Target.MacOs) {
architecture.set(Target.Architecture.X86_64)
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_mac_hotspot_17.0.15_6.tar.gz")
// macOS needs an identifier
identifier.set("ca.modmonster." + appName)
// Optional: icon for macOS, as an ICNS file
macIcon.set(project.file("icons/icons.icns"))
}
register("winX64", Target.Windows) {
architecture.set(Target.Architecture.X86_64)
// Optional: icon for Windows, as a PNG
icon.set(project.file("icons/icons.png"))
jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_windows_hotspot_17.0.15_6.zip")
// Uncomment the next line to show a console when the game runs, to print messages.
//useConsole.set(true)
}
}
}
Loading