Skip to content

Commit f80f940

Browse files
committedSep 30, 2024·
Add mod publishing
1 parent 8b08e9a commit f80f940

File tree

5 files changed

+77
-43
lines changed

5 files changed

+77
-43
lines changed
 

‎.github/workflows/publish.yml

-41
This file was deleted.

‎.github/workflows/release.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: release
2+
on: [workflow_dispatch]
3+
4+
jobs:
5+
release:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Set up JDK 21
10+
uses: actions/setup-java@v4
11+
with:
12+
distribution: 'microsoft'
13+
java-version: 21
14+
- name: Make gradlew executable
15+
run: chmod +x ./gradlew
16+
- name: Publish mods
17+
run: ./gradlew build publishMods
18+
env:
19+
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
20+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [2.0.0] - 2024-09-30
10+
Initial public release

‎build.gradle.kts

+45-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import org.jetbrains.changelog.Changelog
2+
13
plugins {
24
java
35
id("maven-publish")
46
id("fabric-loom") version "1.7.+"
57
kotlin("jvm") version "2.0.20"
68
id("io.github.goooler.shadow") version "8.1.7"
79
kotlin("plugin.serialization") version "2.0.20"
10+
id("me.modmuss50.mod-publish-plugin") version "0.7.4"
11+
id("org.jetbrains.changelog") version "2.+"
812
}
913

1014
configurations.implementation.get().extendsFrom(configurations.shadow.get())
@@ -19,7 +23,7 @@ allprojects {
1923

2024
base.archivesName.set(modId)
2125
group = mavenGroup
22-
version = "$modVersion${getVersionMetadata()}"
26+
version = "$modVersion+${rootProject.libs.versions.minecraft.get()}${getVersionMetadata()}"
2327

2428
java {
2529
sourceCompatibility = JavaVersion.VERSION_21
@@ -118,6 +122,33 @@ dependencies {
118122
}
119123
}
120124

125+
publishMods {
126+
file.set(tasks.remapJar.get().archiveFile)
127+
type.set(STABLE)
128+
changelog.set(fetchChangelog())
129+
130+
displayName.set("Blockbot ${version.get()}")
131+
modLoaders.add("fabric")
132+
modLoaders.add("quilt")
133+
134+
val minecraftVersion = rootProject.libs.versions.minecraft.get()
135+
curseforge {
136+
accessToken.set(providers.environmentVariable("CF_API_TOKEN"))
137+
projectId.set("482904")
138+
minecraftVersions.add(minecraftVersion)
139+
}
140+
modrinth {
141+
accessToken.set(providers.environmentVariable("MODRINTH_TOKEN"))
142+
projectId.set("yKZ9outG")
143+
minecraftVersions.add(minecraftVersion)
144+
}
145+
github {
146+
accessToken.set(providers.environmentVariable("GITHUB_TOKEN"))
147+
repository.set(providers.environmentVariable("GITHUB_REPOSITORY").getOrElse("QuiltServerTools/dryrun"))
148+
commitish.set(providers.environmentVariable("GITHUB_REF_NAME").getOrElse("dryrun"))
149+
}
150+
}
151+
121152
tasks {
122153
remapJar {
123154
dependsOn(shadowJar)
@@ -200,3 +231,16 @@ fun getVersionMetadata(): String {
200231
// No tracking information could be found about the build
201232
return ""
202233
}
234+
235+
private fun fetchChangelog(): String {
236+
val changelog = tasks.getChangelog.get().changelog.get()
237+
val modVersion: String by project
238+
return if (changelog.has(modVersion)) {
239+
changelog.renderItem(
240+
changelog.get(modVersion).withHeader(false),
241+
Changelog.OutputType.MARKDOWN
242+
)
243+
} else {
244+
""
245+
}
246+
}

‎gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Mod
22
modName = BlockBot Discord
33
modId = blockbot-discord
4-
modVersion = 2.0.0-beta
4+
modVersion = 2.0.0
55
mavenGroup = io.github.quiltservertools
66

77
# Other

0 commit comments

Comments
 (0)
Please sign in to comment.