Skip to content

Commit

Permalink
Updated CI and gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
LatvianModder committed Aug 31, 2023
1 parent 5076942 commit dc28b9a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Java CI
on:
push:
branches:
# main and dev versions for each mc ver here
- "main"
workflow_dispatch:
inputs:
Expand All @@ -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
34 changes: 15 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.time.Instant

plugins {
id 'java'
id 'maven-publish'
Expand All @@ -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'

Expand All @@ -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')
}

Expand All @@ -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}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.daemon=false
project_version=1.0
project_version=1.0.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit dc28b9a

Please sign in to comment.