Skip to content

Commit

Permalink
update publishing information
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Feb 29, 2024
1 parent d8fe0f6 commit f698064
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 80 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/build.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/build_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build Status

on:
push:
paths-ignore:
- '.github/**'
branches:
- '*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: 17
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Upload build artifacts (Quilt)
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-Quilt-${{ github.sha }}
path: |
build/libs/!(*-@(dev|slim)).jar
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Upload Release Artifacts

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: 17
- name: Get current time
uses: srfrnk/current-time@master
id: current-time
with:
format: YYYYMMDDHHmmss
- name: Setup ENV
run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Copy Maven Upload URL
id: extract_maven_upload_url
run: echo "maven_upload_url=${{secrets.MAVEN_UPLOAD_URL}}" >> $GITHUB_OUTPUT
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
env:
BUILD_TIME: ${{ steps.current-time.outputs.formattedTime }}
BUILD_NUMBER: ${{ github.run_number }}
run: ./gradlew assemble
- name: Maven Release
if: steps.extract_maven_upload_url.outputs.maven_upload_url
continue-on-error: true
run: ./gradlew publish
env:
BUILD_TIME: ${{ steps.current-time.outputs.formattedTime }}
BUILD_NUMBER: ${{ github.run_number }}
MAVEN_UPLOAD_URL: ${{ secrets.MAVEN_UPLOAD_URL }}
MAVEN_UPLOAD_USERNAME: ${{ secrets.MAVEN_UPLOAD_USERNAME }}
MAVEN_UPLOAD_PASSWORD: ${{ secrets.MAVEN_UPLOAD_PASSWORD }}
- name: Upload build artifacts (Quilt)
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-Quilt-${{ github.sha }}
path: |
build/libs/!(*-@(dev|slim)).jar
- name: Publish (GitHub Releases)
continue-on-error: true
uses: Kir-Antipov/mc-publish@423b200ec84e6eefad726549c72513d7a9b4c2c0 # (new) v3.3
with:
github-token: ${{ github.token }}
files: |
build/libs/!(*-@(dev|sources|javadoc|slim)).jar
build/libs/*-@(sources|javadoc).jar
- name: Publish (Quilt)
continue-on-error: true
uses: Kir-Antipov/mc-publish@423b200ec84e6eefad726549c72513d7a9b4c2c0 # (new) v3.3
with:
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
version: ${{ github.ref_name }}+Quilt
files: |
build/libs/!(*-@(dev|sources|javadoc|slim)).jar
build/libs/*-@(sources|javadoc).jar
117 changes: 79 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@ plugins {
alias libs.plugins.quilt.loom
}

base {
archivesName = project.archives_base_name
// messy workaround for bug in quilt loom 1.3.3+
project.configurations.configureEach {
exclude(group: "net.fabricmc", module: "fabric-loader")
exclude(group: "net.fabricmc.fabric-api")
}

version = "$project.version+${libs.versions.minecraft.get()}"
group = project.maven_group
def javaVersion = 17

group = project.maven_group_id

def ENV = System.getenv()
def NOW = new Date();
def buildTime = ENV.BUILD_TIME ?: NOW.format('yyyyMMddHHmmss')

boolean isPreviewBuild = !ENV.TAG || ENV.TAG.matches(".+-.+")
def buildNumber = !ENV.TAG ? ("${ENV.BUILD_NUMBER ? "build.${ENV.BUILD_NUMBER}" : buildTime}") : ""
version = (ENV.TAG ?: "${libs.versions.minecraft.get()}-development") + ((isPreviewBuild && !ENV.TAG) ? "+${buildNumber}" : "")

base {
archivesName = "${rootProject.name}-Quilt"
}

repositories {
mavenCentral()
Expand All @@ -18,10 +33,13 @@ repositories {

loom {
mods {
"ok_zoomer" {
"${project.mod_id}" {
sourceSet("main")
}
}
mixin {
defaultRefmapName.set("${project.mod_id}.refmap.json")
}
}

// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>"
Expand All @@ -33,65 +51,88 @@ dependencies {
modImplementation libs.quilt.loader

modImplementation libs.quilted.fabric.api
modImplementation(libs.mod.menu) {
transitive = false
}
modImplementation libs.libzoomer
modImplementation(libs.spruceui) {
transitive = false
}

modCompileOnly libs.modmenu
modLocalRuntime libs.modmenu

modImplementation libs.libzoomer
include libs.libzoomer

modImplementation libs.spruceui
include libs.spruceui
}

processResources {
inputs.property 'version', version
filteringCharset "UTF-8"

filesMatching('quilt.mod.json') {
expand 'version': version
}
}
def expandProps = [
"version" : version,
"maven_group_id" : maven_group_id,
"mod_id" : mod_id,
"minecraft_version" : libs.versions.minecraft.get(),
"curseforge_id" : curseforge_id,
"modrinth_id" : modrinth_id,

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
"quilt_loader_version" : libs.versions.quilt.loader.get(),
]

filesMatching(['*.mod.json', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}

java {
// Still required by IDEs such as Eclipse and Visual Studio Code
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
vendor = JvmVendorSpec.MICROSOFT
}
withSourcesJar()
// withJavadocJar()
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

// If this mod is going to be a library, then it should also generate Javadocs in order to aid with developement.
// Uncomment this line to generate them.
// withJavadocJar()
jar {
from('LICENSE') {
rename { "LICENSE_${base.archivesName.get()}" }
}
}

jar {
sourcesJar {
from('LICENSE') {
rename { "${it}_${base.archivesName.get()}" }
rename { "LICENSE_${base.archivesName.get()}" }
}
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = 17
}

// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

// Configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifactId "${rootProject.name}-Quilt"
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
if (ENV.MAVEN_UPLOAD_URL) {
maven {
url = ENV.MAVEN_UPLOAD_URL
credentials {
username = ENV.MAVEN_UPLOAD_USERNAME
password = ENV.MAVEN_UPLOAD_PASSWORD
}
}
}
}
}
13 changes: 8 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Gradle Properties
org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Mod Properties
version = 5.0.2
maven_group = io.github.ennuil
archives_base_name = ok_zoomer
mod_id=ok_zoomer

# Publishing
maven_group_id=io.github.ennuil.ok-zoomer
curseforge_id=354047
modrinth_id=aXf2OSFU
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ quilt_loader = "0.23.1"

quilted_fabric_api = "8.0.0-alpha.4+0.91.6-1.20.2"
libzoomer = "0.8.0+1.20.1"
mod_menu = "8.0.1"
modmenu = "8.0.1"
spruceui = "5.0.3+1.20.2"

[libraries]
Expand All @@ -16,7 +16,7 @@ quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loade

quilted_fabric_api = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api", version.ref = "quilted_fabric_api" }
libzoomer = { module = "io.github.ennuil:LibZoomer", version.ref = "libzoomer" }
mod_menu = { module = "com.terraformersmc:modmenu", version.ref = "mod_menu" }
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
spruceui = { module = "dev.lambdaurora:spruceui", version.ref = "spruceui" }

[plugins]
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ pluginManagement {
gradlePluginPortal()
}
}

rootProject.name = 'OkZoomer'
Loading

0 comments on commit f698064

Please sign in to comment.