forked from Devan-Kerman/ARRP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
301 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build | ||
on: | ||
- pull_request | ||
- push | ||
|
||
jobs: | ||
build: | ||
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Set up JDK 17 | ||
run: apt install -y openjdk-17-jdk | ||
- name: Use Gradle cache for faster builds | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
- name: Cleanup Gradle Cache | ||
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | ||
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties | ||
- name: Setup Gradle Wrapper Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | ||
- name: Build | ||
run: ./gradlew build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: arrp | ||
path: build/libs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Set up JDK 17 | ||
run: apt install -y openjdk-17-jdk | ||
- name: Build | ||
run: ./gradlew build | ||
env: | ||
ARRP_VERSION: ${{ github.event.release.tag_name }} | ||
- name: Upload Release Artifact | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: build/libs/arrp-${{ github.event.release.tag_name }}.jar | ||
tag_name: ${{ github.event.release.tag_name }} | ||
- name: Upload to external sites | ||
run: ./gradlew curseforge modrinth publishAllPublicationsToModmavenRepository | ||
env: | ||
ARRP_VERSION: ${{ github.event.release.tag_name }} | ||
CURSEFORGE: ${{ secrets.CURSEFORGE }} | ||
MODRINTH: ${{ secrets.MODRINTH }} | ||
MODMAVEN: ${{ secrets.MODMAVEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,95 @@ | ||
plugins { | ||
id 'fabric-loom' version '1.0-SNAPSHOT' | ||
id 'maven-publish' | ||
id "me.shedaniel.unified-publishing" version "0.1.+" | ||
id("fabric-loom") version "1.0-SNAPSHOT" | ||
id("me.shedaniel.unified-publishing") version "0.1.+" | ||
id("maven-publish") | ||
} | ||
|
||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
|
||
archivesBaseName = project.archives_base_name | ||
version = project.mod_version | ||
group = project.maven_group | ||
group = "net.devtech" | ||
version = System.getenv("ARRP_VERSION") ?: "0.0.0" | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
modImplementation include(fabricApi.module('fabric-api-base', project.fabric_version)) | ||
minecraft("com.mojang:minecraft:${minecraft_version}") | ||
mappings("net.fabricmc:yarn:${yarn_mappings}:v2") | ||
modImplementation("net.fabricmc:fabric-loader:${loader_version}") | ||
modImplementation(include(fabricApi.module("fabric-api-base", fabric_version))) | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
base { | ||
archivesName.set("arrp") | ||
} | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
withSourcesJar() | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
it.options.release = 17 | ||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
processResources { | ||
inputs.property("version", project.version) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand("version": project.version) | ||
} | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
rename { "${it}_${base.archivesName.get()}"} | ||
} | ||
} | ||
|
||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
from(components.java) | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
def mavenUrl = project.hasProperty('maven_url') ? project.property('maven_url') : "" | ||
url mavenUrl | ||
if (mavenUrl.startsWith("http")) { | ||
credentials { | ||
username project.hasProperty('maven_username') ? project.property('maven_username') : "" | ||
password project.hasProperty('maven_password') ? project.property('maven_password') : "" | ||
} | ||
name = "Project" | ||
url = uri("${buildDir}/repo") | ||
} | ||
|
||
maven { | ||
credentials { | ||
username = "" | ||
password = System.getenv("MODMAVEN") | ||
} | ||
|
||
name = "Modmaven" | ||
url = "https://modmaven.dev/artifactory/local-releases/" | ||
} | ||
} | ||
} | ||
|
||
File file = file("tokens.properties") | ||
if(file.exists()) { | ||
Properties properties = new Properties() | ||
try (InputStream stream = new FileInputStream(file)) { | ||
properties.load(stream) | ||
} | ||
unifiedPublishing { | ||
project { | ||
gameVersions.add(minecraft_version) | ||
gameVersions.add("fabric") | ||
|
||
unifiedPublishing { | ||
project { | ||
gameVersions = ["1.19.3"] | ||
gameLoaders = ["fabric"] | ||
changelog.set("View changelog at [the release page](https://github.com/Devan-Kerman/ARRP/releases/tag/${version})") | ||
|
||
mainPublication tasks.remapJar // Declares the publicated jar | ||
mainPublication(tasks.remapJar) | ||
|
||
var cfToken = properties.getProperty("cf_token") | ||
if (cfToken != null) { | ||
curseforge { | ||
token = cfToken | ||
id = "463113" // Required, must be a string, ID of CurseForge project | ||
} | ||
System.getenv("CURSEFORGE")?.with { String key -> | ||
curseforge { | ||
token.set(key) | ||
id.set("463113") | ||
} | ||
} | ||
|
||
var mrToken = properties.getProperty("mr_token") | ||
if (mrToken != null) { | ||
modrinth { | ||
token = mrToken | ||
id = "USLVyT7V" // Required, must be a string, ID of Modrinth project | ||
} | ||
System.getenv("MODRINTH")?.with { String key -> | ||
modrinth { | ||
token.set(key) | ||
id.set("USLVyT7V") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.