Skip to content

Commit

Permalink
Build with gradle (#40)
Browse files Browse the repository at this point in the history
* Build with gradle

Signed-off-by: Joshua Castle <[email protected]>

* build/pr with github actions

Signed-off-by: Joshua Castle <[email protected]>

* Rem .jar from gitignore to include gradle wrapper

Signed-off-by: Joshua Castle <[email protected]>

* Move tag logic to end of release.yml

Signed-off-by: Joshua Castle <[email protected]>

* handle no tag

Signed-off-by: Joshua Castle <[email protected]>

* Better fix for tags

Signed-off-by: Joshua Castle <[email protected]>

---------

Signed-off-by: Joshua Castle <[email protected]>
  • Loading branch information
Kas-tle authored Aug 3, 2023
1 parent c7f5c08 commit 24ec894
Show file tree
Hide file tree
Showing 25 changed files with 657 additions and 343 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Pull Request

on:
pull_request:
paths-ignore:
- '.gitignore'
- 'egg-m-c-xbox-broadcast.json'
- 'LICENSE'
- 'README.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Checkout repository
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
gradle-home-cache-cleanup: true
- uses: actions/upload-artifact@v3
if: success()
with:
name: MCXboxBroadcastExtension
path: bootstrap/geyser/build/libs/MCXboxBroadcastExtension.jar
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: success()
with:
name: MCXboxBroadcastStandalone
path: bootstrap/standalone/build/libs/MCXboxBroadcastStandalone.jar
if-no-files-found: error
80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build Release
on:
workflow_dispatch:
push:
branches:
- "master"
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
gradle-home-cache-cleanup: true
- uses: actions/upload-artifact@v3
if: success()
with:
name: MCXboxBroadcastExtension
path: bootstrap/geyser/build/libs/MCXboxBroadcastExtension.jar
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: success()
with:
name: MCXboxBroadcastStandalone
path: bootstrap/standalone/build/libs/MCXboxBroadcastStandalone.jar
if-no-files-found: error
- name: Get previous build number
id: getPreviousBuild
uses: WyriHaximus/github-action-get-previous-tag@v1
if: success()
with:
fallback: ''
- name: Get current build number
id: getCurrentBuild
if: success()
env:
PREVIOUS_BUILD: ${{ steps.getPreviousBuild.outputs.tag }}
run: echo result=$((++PREVIOUS_BUILD)) >> $GITHUB_OUTPUT
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
if: success()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ''
custom_tag: ${{ steps.getCurrentBuild.outputs.result }}
- name: Generate release diff
if: success()
env:
BEGIN_COMMIT: ${{ steps.getPreviousBuild.outputs.tag }}
END_COMMIT: ${{ steps.getCurrentBuild.outputs.result }}
run: git fetch --tags --force && git log --pretty=format:"* %s (%h)" ${BEGIN_COMMIT}..${END_COMMIT} > release_notes.md
- name: Create release
uses: ncipollo/release-action@v1
if: success()
with:
artifacts: "bootstrap/geyser/build/libs/MCXboxBroadcastExtension.jar,bootstrap/standalone/build/libs/MCXboxBroadcastStandalone.jar,egg-m-c-xbox-broadcast.json"
allowUpdates: true
bodyFile: "release_notes.md"
draft: false
prerelease: false
name: Build ${{ steps.getCurrentBuild.outputs.result }} (${{ github.ref_name }})
tag: ${{ steps.getCurrentBuild.outputs.result }}
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ local.properties
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
Expand Down Expand Up @@ -138,6 +137,9 @@ replay_pid*
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
.gradle
**/build
build/

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
Expand Down
24 changes: 0 additions & 24 deletions Jenkinsfile

This file was deleted.

17 changes: 17 additions & 0 deletions bootstrap/geyser/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id("com.rtm516.mcxboxbroadcast.shadow-conventions")
}

relocate("org.yaml.snakeyaml")
relocate("com.fasterxml.jackson")

dependencies {
api(project(":core"))
api(libs.bundles.jackson.yaml)
compileOnly(libs.bundles.geyser)
compileOnly(libs.floodgate.spigot)
}

nameJar("MCXboxBroadcastExtension")

description = "bootstrap-geyser"
98 changes: 0 additions & 98 deletions bootstrap/geyser/pom.xml

This file was deleted.

64 changes: 0 additions & 64 deletions bootstrap/pom.xml

This file was deleted.

20 changes: 20 additions & 0 deletions bootstrap/standalone/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id("com.rtm516.mcxboxbroadcast.shadow-conventions")
}

dependencies {
api(project(":core"))
api(libs.bundles.jackson.yaml)
api(libs.bedrock.common)
api(libs.slf4j.simple)
}

tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "com.rtm516.mcxboxbroadcast.bootstrap.standalone.StandaloneMain"
}
}

nameJar("MCXboxBroadcastStandalone")

description = "bootstrap-standalone"
Loading

0 comments on commit 24ec894

Please sign in to comment.