From 58044d662e05e50db8b8bc6a1626bcddb022e3be Mon Sep 17 00:00:00 2001 From: Smyler Date: Wed, 1 Jan 2025 23:14:46 +0100 Subject: [PATCH] Publish build snapshots to Maven from GitHub actions --- .github/workflows/gradle.yml | 22 --------------- .github/workflows/publish-snapshot.yml | 20 ++++++++++++++ .github/workflows/test.yml | 18 ++++++++++++ README.md | 38 ++++++++++++++++---------- build.gradle | 22 ++++++++++----- 5 files changed, 77 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/gradle.yml create mode 100644 .github/workflows/publish-snapshot.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 3d08bbd9..00000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew test diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml new file mode 100644 index 00000000..942720ce --- /dev/null +++ b/.github/workflows/publish-snapshot.yml @@ -0,0 +1,20 @@ +name: Publish snapshot build +on: + - push +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Publish with Gradle + run: ./gradlew build publish + env: + MAVEN_NAME: ${{ secrets.MAVEN_NAME }} + MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..89b61889 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +name: Run tests +on: + - push + - pull_request +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew test diff --git a/README.md b/README.md index 6d0c813b..c7018c46 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@
-

TerraMinusMinus

+

TerraMinusMinus

+ GitHub License + GitHub Workflow Status
-[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?style=flat-square)](https://github.com/BuildTheEarth/terraplusplus/blob/master/LICENSE.MD) -![GitHub Workflow Status](https://img.shields.io/github/workflow/status/SmylerMC/terraminusminus/Java%20CI%20with%20Gradle?style=flat-square) + ## What is it? @@ -13,16 +14,22 @@ Terra-- is a fork of Terra++ intended to strip down dependencies to Minecraft an ### :warning: This project is still experimental -Just add Jitpack as a maven repository to your `build.gradle`, as well as the repositories needed for Terra--'s dependencies, and declare this repository as a dependency to your own project. +Just add the required maven repositories to your `build.gradle`, and declare Terraminusminus as a dependency. -E.g. : -``` +I.e.: +```groovy repositories { + + // Smyler's repository has the Terraminusminus builds + maven { + name = "Smyler Snapshots" + url = "https://maven.smyler.net/snapshots/" + } // Classic JCenter repository that has most of what we need jcenter() - // JitPack will build this repo and provide it as a dependency + // JitPack is required to build some dependencies maven { name = "JitPack" url = "https://jitpack.io/" @@ -44,17 +51,20 @@ repositories { dependencies { - // Include this repository as a dependency through Jitpack - // master-SNAPSHOT indicates to use the latest commit on master, - // you can replace this with a commit hash or a reference to anoter branch - compile 'com.github.SmylerMC:terraminusminus:master-SNAPSHOT' - - - // Your other depencencies would go down there... + // Include this repository as a dependency. + // master-SNAPSHOT indicates to use the last commit built from master, + // you can replace this with a reference to another branch + compile 'net.buildtheart:terraminusminus:master-SNAPSHOT' + // Your other dependencies would go down there... } ``` +### Release channels + +At this point, only branch snapshots are available. +You can browse the available builds at [maven.smyler.net](https://maven.smyler.net/#/snapshots/net/buildtheearth/terraminusminus). + ## APIs: - Tree cover data: [treecover2000 v1.7](https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.7.html) hosted by [@DaPorkchop_](https://github.com/DaMatrix) diff --git a/build.gradle b/build.gradle index 0bfbdd34..b358249e 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ compileJava { options.compilerArgs << '--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED' } -version = ("0.0.1-" + ('git rev-parse --abbrev-ref HEAD'.execute().text.trim()) + "-" + ('git rev-parse --short HEAD'.execute().text.trim())).replace("/", "-") +version = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim().replace("/", "-") + "-SNAPSHOT" group = "net.buildtheearth" repositories { @@ -74,14 +74,22 @@ dependencies { } publishing { + repositories { + maven { + name = "smylerSnapshots" + url = uri("https://maven.smyler.net/snapshots") + credentials { + username System.getenv("MAVEN_NAME") + password System.getenv("MAVEN_SECRET") + } + } + } publications { - maven(MavenPublication) { + terraminusminus(MavenPublication) { groupId = project.group - artifactId = 'terraminusminus' + artifactId = "terraminusminus" version = project.version - - from components.java + from(components["java"]) } } -} - +} \ No newline at end of file