Skip to content

Commit 05c08b8

Browse files
fix: workflows and releasing to maven
1 parent b61a656 commit 05c08b8

4 files changed

Lines changed: 30 additions & 45 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ jobs:
99
build:
1010
if: |
1111
!contains(github.event.head_commit.message, '[ciskip]')
12-
uses: nanite/workflows/.github/workflows/standard-modmuss.yml@v1.1
12+
uses: nanite/workflows/.github/workflows/release.yml@v1.3
1313
with:
1414
java-version: 25
15-
changelog-file: "./CHANGELOG.md"
16-
release-to-github: false
15+
gradle-tasks: build publish publishMods
1716
secrets:
1817
nanite-token: ${{ secrets.NANITE_DEPLOY }}
1918
curse-token: ${{ secrets.CURSE_DEPLOY }}
20-
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
19+
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

build.gradle

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ plugins {
77

88
def ENV = System.getenv()
99

10-
version = "${mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${minecraft_version}"
11-
group = maven_group
12-
1310
allprojects {
1411
apply plugin: 'idea'
1512
apply plugin: 'java-library'
1613
apply plugin: 'maven-publish'
1714

18-
version = rootProject.version
15+
version = "${mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${minecraft_version}"
16+
group = maven_group
1917

2018
repositories {
2119
mavenLocal()
@@ -55,25 +53,11 @@ allprojects {
5553
downloadJavadoc = true
5654
}
5755
}
58-
59-
publishing {
60-
repositories {
61-
if (ENV.NANITE_TOKEN) {
62-
maven {
63-
url "https://maven.nanite.dev/releases"
64-
credentials {
65-
username = "nanite"
66-
password = "${ENV.NANITE_TOKEN}"
67-
}
68-
}
69-
}
70-
}
71-
}
7256
}
7357

7458
subprojects {
7559
base {
76-
archivesName = "${archives_base_name}-$project.name"
60+
archivesName = rootProject.archives_base_name + project.name
7761
}
7862

7963
if (project.name != "common") {
@@ -106,6 +90,28 @@ subprojects {
10690
expand replaceProperties
10791
}
10892
}
93+
94+
publishing {
95+
publications {
96+
register("maven${project.name.capitalize()}", MavenPublication) {
97+
artifactId = "${rootProject.archives_base_name}-${project.name}"
98+
from components.java
99+
}
100+
}
101+
102+
repositories {
103+
def token = providers.environmentVariable("NANITE_TOKEN");
104+
if (token.isPresent()) {
105+
maven {
106+
url "https://maven.nanite.dev/releases"
107+
credentials {
108+
username = "nanite"
109+
password = providers.environmentVariable("NANITE_TOKEN").get()
110+
}
111+
}
112+
}
113+
}
114+
}
109115
}
110116

111117
publishMods {

fabric/build.gradle

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,4 @@ dependencies {
3232

3333
java {
3434
withSourcesJar()
35-
}
36-
37-
publishing {
38-
publications {
39-
mavenFabric(MavenPublication) {
40-
groupId project.group
41-
artifactId project.base.archivesName.get()
42-
version project.version
43-
from components.java
44-
}
45-
}
46-
}
35+
}

neoforge/build.gradle

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,4 @@ dependencies {
5656

5757
java {
5858
withSourcesJar()
59-
}
60-
61-
publishing {
62-
publications {
63-
mavenNeoForge(MavenPublication) {
64-
artifactId = rootProject.base.archivesName.get()
65-
from components.java
66-
}
67-
}
68-
}
59+
}

0 commit comments

Comments
 (0)