Skip to content

Commit

Permalink
Update gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
RealMangorage committed May 13, 2024
1 parent bee86ad commit 9678a52
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 12 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 22 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9678a52

Please sign in to comment.