From 894e45808ce645d1e1097bc3af37b5d1aae5aa55 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Tue, 4 Jun 2024 22:14:41 -0500 Subject: [PATCH] add ci --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++ .github/workflows/build_snapshot.yml | 30 ++++++++++++++++++++++++++++ build.gradle.kts | 22 +++++++++++++++++++- gradle.properties | 2 ++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/build_snapshot.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f41cf54 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Build Release +on: + release: + types: [ created ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '17' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Publish + run: ./gradlew publish -Pmvn.user=${{ secrets.MAVEN_USER }} -Pmvn.key=${{ secrets.MAVEN_TOKEN }} + + - uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: ./build/libs/ \ No newline at end of file diff --git a/.github/workflows/build_snapshot.yml b/.github/workflows/build_snapshot.yml new file mode 100644 index 0000000..f332387 --- /dev/null +++ b/.github/workflows/build_snapshot.yml @@ -0,0 +1,30 @@ +name: Build Snapshot + +on: + push: + branches-ignore: + - 'feature/**' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Publish + run: ./gradlew publish -Pversion_snapshot -Pmvn.user=${{ secrets.MAVEN_USER }} -Pmvn.key=${{ secrets.MAVEN_TOKEN }} -x test + + - uses: actions/upload-artifact@v2 + with: + name: Snapshot Artifacts + path: ./build/libs/ \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 1ff358c..2acfe21 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import java.net.URI + plugins { kotlin("jvm") version "1.9.22" `java-gradle-plugin` @@ -5,7 +7,7 @@ plugins { } group = "xyz.wagyourtail.unimined.expect-platform" -version = "1.0-SNAPSHOT" +version = if (project.hasProperty("version_snapshot")) project.properties["version"] as String + "-SNAPSHOT" else project.properties["version"] as String base { archivesName.set("expect-platform") @@ -19,6 +21,10 @@ java { withJavadocJar() withSourcesJar() + + toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + } } repositories { @@ -76,6 +82,20 @@ gradlePlugin { } publishing { + repositories { + maven { + name = "WagYourMaven" + url = if (project.hasProperty("version_snapshot")) { + URI.create("https://maven.wagyourtail.xyz/snapshots/") + } else { + URI.create("https://maven.wagyourtail.xyz/releases/") + } + credentials { + username = project.findProperty("mvn.user") as String? ?: System.getenv("USERNAME") + password = project.findProperty("mvn.key") as String? ?: System.getenv("TOKEN") + } + } + } publications { create("mavenJava") { groupId = "xyz.wagyourtail.unimined.expect-platform" diff --git a/gradle.properties b/gradle.properties index 5216150..8d56ef7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,5 @@ kotlin.code.style=official +version = 1.0.0 + asmVersion=9.7 \ No newline at end of file