diff options
-rw-r--r-- | .github/workflows/build.yml | 42 | ||||
-rw-r--r-- | .github/workflows/release.yml | 52 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | build.gradle | 34 | ||||
-rw-r--r-- | src/main/java/net/elytrium/limboauth/Settings.java | 24 |
5 files changed, 121 insertions, 33 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 835eb68..9f98d62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,38 +5,58 @@ on: [ push, pull_request ] jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - java: [ 11, 17 ] - fail-fast: true steps: - name: Checkout uses: actions/checkout@v3.0.0 - - name: Set up JDK ${{ matrix.java }} + - name: Set up JDK uses: actions/setup-java@v3.0.0 with: distribution: adopt - java-version: ${{ matrix.java }} + java-version: 11 - name: Build LimboAuth run: ./gradlew build - name: Upload LimboAuth uses: actions/upload-artifact@v3.0.0 with: - name: LimboAuth Built On ${{ matrix.java }} JDK + name: LimboAuth path: "build/libs/limboauth*.jar" - uses: dev-drprasad/delete-tag-and-release@v0.2.0 if: ${{ github.event_name == 'push' }} with: delete_release: true - tag_name: dev-build-jdk-${{ matrix.java }} + tag_name: dev-build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Find git version + id: git-version + run: echo "id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Find correct JAR + if: ${{ github.event_name == 'push' }} + id: find-jar + run: | + output="$(find build/libs/ ! -name "*-javadoc.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" + echo "::set-output name=jarname::$output" - name: Release the build if: ${{ github.event_name == 'push' }} uses: ncipollo/release-action@v1 with: - artifacts: "build/libs/limboauth*.jar" + artifacts: build/libs/${{ steps.find-jar.outputs.jarname }} body: ${{ join(github.event.commits.*.message, '\n') }} prerelease: true - name: JDK ${{ matrix.java }} Dev-build - tag: dev-build-jdk-${{ matrix.java }} + name: Dev-build ${{ steps.git-version.outputs.id }} + tag: dev-build + - name: Upload to Modrinth + if: ${{ github.event_name == 'push' }} + uses: RubixDev/modrinth-upload@v1.0.0 + with: + token: ${{ secrets.MODRINTH_TOKEN }} + file_path: build/libs/${{ steps.find-jar.outputs.jarname }} + name: Dev-build ${{ steps.git-version.outputs.id }} + version: ${{ steps.git-version.outputs.id }} + changelog: ${{ join(github.event.commits.*.message, '\n') }} + relations: TZOteSf2:required + game_versions: 1.7.2 + release_type: beta + loaders: velocity + featured: false + project_id: 4iChqdl8 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..52481c5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Java CI with Gradle + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.0.0 + - name: Set up JDK + uses: actions/setup-java@v3.0.0 + with: + distribution: adopt + java-version: 11 + - name: Build LimboAuth + run: ./gradlew build + - name: Upload LimboAuth + uses: actions/upload-artifact@v3.0.0 + with: + name: LimboAuth + path: "build/libs/limboauth*.jar" + - name: Find correct JAR + id: find-jar + run: | + output="$(find build/libs/ ! -name "*-javadoc.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" + echo "::set-output name=jarname::$output" + - name: Upload to the GitHub release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/libs/${{ steps.find-jar.outputs.jarname }} + asset_name: ${{ steps.find-jar.outputs.jarname }} + asset_content_type: application/java-archive + - name: Upload to Modrinth + uses: RubixDev/modrinth-upload@v1.0.0 + with: + token: ${{ secrets.MODRINTH_TOKEN }} + file_path: build/libs/${{ steps.find-jar.outputs.jarname }} + name: Release ${{ github.event.release.tag_name }} + version: ${{ github.event.release.tag_name }} + changelog: ${{ github.event.release.body }} + relations: TZOteSf2:required + game_versions: 1.7.2 + release_type: release + loaders: velocity + featured: true + project_id: 4iChqdl8 @@ -1 +1 @@ -1.1.5 +1.1.6 diff --git a/build.gradle b/build.gradle index d159a01..70635ea 100644 --- a/build.gradle +++ b/build.gradle @@ -195,14 +195,30 @@ artifacts { archives(sourcesJar) } -sourceSets.main.getJava().srcDir(getTasks().register("generateTemplates", Copy) { task -> - task.getInputs().properties("version": getVersion()) - - task.from(file("src/main/templates")) - .into(getLayout().getBuildDirectory().dir("generated/sources/templates")) - .expand("version": getVersion()) -}.map { - it.getOutputs() -}) +sourceSets.main.getJava().srcDir( + getTasks().register("generateTemplates", Copy) { + task -> { + String version = getVersion().contains("-") ? "${getVersion()} (git-${getCurrentShortRevision()})" : getVersion() + task.getInputs().properties("version": version) + task.from(file("src/main/templates")).into(getLayout().getBuildDirectory().dir("generated/sources/templates")) + task.expand("version": version) + } + }.map { + it.getOutputs() + } +) assemble.dependsOn(shadowJar) + +String getCurrentShortRevision() { + OutputStream outputStream = new ByteArrayOutputStream() + exec { + if (System.getProperty("os.name").toLowerCase().contains("win")) { + commandLine("cmd", "/c", "git rev-parse --short HEAD") + } else { + commandLine("bash", "-c", "git rev-parse --short HEAD") + } + + setStandardOutput(outputStream) + } +}
\ No newline at end of file diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index 96687ca..b83341a 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -246,6 +246,18 @@ public class Settings extends YamlConfig { } @Create + public MAIN.AUTH_COORDS AUTH_COORDS; + + public static class AUTH_COORDS { + + public double X = 0; + public double Y = 0; + public double Z = 0; + public double YAW = 0; + public double PITCH = 0; + } + + @Create public Settings.MAIN.CRACKED_TITLE_SETTINGS CRACKED_TITLE_SETTINGS; public static class CRACKED_TITLE_SETTINGS { @@ -398,18 +410,6 @@ public class Settings extends YamlConfig { public String MOD_SESSION_EXPIRED = "{PRFX} Your session has expired, log in again."; } - - @Create - public MAIN.AUTH_COORDS AUTH_COORDS; - - public static class AUTH_COORDS { - - public double X = 0; - public double Y = 0; - public double Z = 0; - public double YAW = 0; - public double PITCH = 0; - } } @Create |