Skip to content

Commit

Permalink
Fixed desktop:dist, added github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
retrodaredevil committed May 12, 2023
1 parent 13d57d4 commit e801823
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release Upload

on:
release:
types: [published]

jobs:
shared-outputs:
name: Shared Outputs
runs-on: ubuntu-latest
outputs:
version: ${{ steps.modified_tag.outputs.version }}
steps:
- id: modified_tag
name: Modify Tag
run: |
tag_name="${{ github.event.release.tag_name }}"
version=$(echo "$tag_name" | sed "s/v//")
echo "::set-output name=version::$version"
release:
name: Upload Release Assets
runs-on: ubuntu-latest
needs: shared-outputs
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Build with Gradle
run: ./gradlew desktop:dist
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./desktop/build/libs/desktop-1.0.jar
asset_name: TrackShooter-${{ needs.shared-outputs.outputs.version }}.jar
asset_content_type: application/octet-stream
18 changes: 11 additions & 7 deletions desktop/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ targetCompatibility = JavaVersion.VERSION_1_8
project.ext.mainClassName = "me.retrodaredevil.game.trackshooter.desktop.DesktopLauncher"
//project.ext.assetsDir = new File("../android/assets");

dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
}

task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
Expand All @@ -27,7 +34,10 @@ task debug(dependsOn: classes, type: JavaExec) {
task dist(type: Jar) {
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from {
duplicatesStrategy DuplicatesStrategy.EXCLUDE
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
// from files(project.assetsDir);

manifest {
Expand All @@ -37,9 +47,3 @@ task dist(type: Jar) {

dist.dependsOn classes

dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
}

0 comments on commit e801823

Please sign in to comment.