Skip to content

Commit

Permalink
Publish build snapshots to Maven from GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC authored Jan 1, 2025
1 parent 129fe54 commit 58044d6
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 43 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/gradle.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<div align="center">
<h1>TerraMinusMinus</h1>
<h1>TerraMinusMinus</h1>
<img alt="GitHub License" src="https://img.shields.io/github/license/SmylerMC/terraminusminus?style=flat-square">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/SmylerMC/terraminusminus/test.yml?style=flat-square">
</div>

[![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?

Expand All @@ -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/"
Expand All @@ -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)
Expand Down
22 changes: 15 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"])
}
}
}

}

0 comments on commit 58044d6

Please sign in to comment.