From 9678a52bd06a5f334a496af9f6d83937a699ea7f Mon Sep 17 00:00:00 2001 From: RealMangoRage <64402114+RealMangorage@users.noreply.github.com> Date: Sun, 12 May 2024 19:57:46 -0700 Subject: [PATCH] Update gradle --- .github/workflows/gradle.yml | 31 ++++++++++++++++++++++ build.gradle | 33 ++++++++++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..b809483 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,31 @@ +name: Bump Patch, Publish and Restart Discord Bot (Gradle) + +on: + push: + branches: [ master ] + +jobs: + publish: # Publish to maven + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Fix gradlew permissions (optional) + run: chmod +x gradlew + + - name: Publish + env: + MAVEN_USERNAME: ${{ secrets.USERNAME }} # Reference the secret\ + MAVEN_PASSWORD: ${{ secrets.PASSWORD }} # Reference the secret\ + run: ./gradlew publish -DskipTests \ No newline at end of file diff --git a/build.gradle b/build.gradle index 38dfb4a..957e55e 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,6 @@ buildscript { repositories { mavenLocal() mavenCentral() - jcenter() maven { url = uri("https://plugins.gradle.org/m2/") } @@ -18,12 +17,29 @@ apply plugin: 'java' apply plugin: 'maven-publish' group = 'org.mangorage' -version = '2.2.4' +version = '3.0.' + getGitVersion() + +def getGitVersion() { + def result = "git rev-list HEAD --count".execute().text.trim() + if (result.empty) { + throw new RuntimeException("Failed to retrieve commit count") + } else { + def commitCount = result.toInteger() + // Use the commitCount variable further in your script + return commitCount; + } +} repositories { mavenCentral() } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + dependencies { testImplementation platform('org.junit:junit-bom:5.9.1') testImplementation 'org.junit.jupiter:junit-jupiter' @@ -54,9 +70,6 @@ publishing { publications.register("installer", MavenPublication) { artifact shadowJar - groupId = 'io.github.realmangorage' - artifactId = 'installer' - pom { name = 'MangoBot Installer' description = 'The Installer for my Discord Bot Project' @@ -76,13 +89,11 @@ publishing { repositories { maven { - def releasesRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/releases/' - def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - group "io.github.mangorage" + url = "https://maven.minecraftforge.net/" + credentials { - username = findProperty("mango.maven.username") - password = findProperty("mango.maven.password") + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ef093d2..909d488 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Oct 25 15:49:45 PDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists