diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed91ecd..cfc783f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ name: Java CI on: push: branches: - # main and dev versions for each mc ver here - "main" workflow_dispatch: inputs: @@ -18,19 +17,25 @@ jobs: if: | !contains(github.event.head_commit.message, '[ci skip]') steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 30 # Gets the last 30 commits so the changelog might work + - name: Checkout + uses: actions/checkout@v3 + - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '17' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Validate Gradle Wrapper uses: gradle/wrapper-validation-action@v1 + - name: Build and Publish with Gradle uses: gradle/gradle-build-action@v2 env: - SAPS_TOKEN: ${{ secrets.SAPS_TOKEN }} + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} with: arguments: build -x test publish --stacktrace --no-daemon \ No newline at end of file diff --git a/build.gradle b/build.gradle index 582e330..3939852 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import java.time.Instant + plugins { id 'java' id 'maven-publish' @@ -7,7 +9,7 @@ sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 def ENV = System.getenv() -version = "${project_version}.${ENV.GITHUB_RUN_NUMBER ?: '9999'}" +version = "${project_version}-${ENV.GITHUB_RUN_NUMBER ? 'build.' + ENV.GITHUB_RUN_NUMBER : 'local.' + Instant.now().epochSecond}" archivesBaseName = 'webutils' group = 'dev.latvian.apps' @@ -22,16 +24,14 @@ repositories { } dependencies { - implementation('net.dv8tion:JDA:5.0.0-beta.5') - implementation('io.javalin:javalin:5.4.2') - implementation('org.mongodb:mongodb-driver-sync:4.9.0') - // implementation('com.google.code.gson:gson:2.9.0') + implementation('net.dv8tion:JDA:5.0.0-beta.12') + implementation('io.javalin:javalin:5.6.1') + implementation('org.mongodb:mongodb-driver-sync:4.10.2') // implementation('org.slf4j:slf4j-simple:2.0.5') // implementation('com.google.guava:guava:31.1-jre') { exclude group: "com.google.code.findbugs" } - - compileOnly('org.jetbrains:annotations:23.0.0') - testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.0') - testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.9.0') + compileOnly('org.jetbrains:annotations:24.0.1') + testImplementation('org.junit.jupiter:junit-jupiter-api:5.10.0') + testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.10.0') testImplementation('junit:junit:4.13.2') } @@ -45,29 +45,25 @@ test { useJUnitPlatform() } -task sourceJar(type: Jar) { - archiveClassifier = "sources" - from sourceSets.main.allSource +java { + withSourcesJar() } -tasks.build.dependsOn tasks.sourceJar - publishing { publications { mavenIchor(MavenPublication) { artifactId = 'webutils' from components.java - artifact sourceJar } } repositories { - if (ENV.SAPS_TOKEN) { + if (ENV.MAVEN_TOKEN) { maven { - url "https://maven.saps.dev/releases" + url "https://maven.latvian.dev/releases" credentials { - username = "latvian" - password = "${ENV.SAPS_TOKEN}" + username = "lat" + password = "${ENV.MAVEN_TOKEN}" } } } diff --git a/gradle.properties b/gradle.properties index d6bacbd..53f5c17 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.jvmargs=-Xmx2G org.gradle.daemon=false -project_version=1.0 \ No newline at end of file +project_version=1.0.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c7960c1..3e66045 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Wed Dec 18 16:24:02 EET 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists