Skip to content

Commit

Permalink
Add mod publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
DrexHD committed Jul 4, 2024
1 parent 6de9397 commit a087323
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: release
on: [workflow_dispatch]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 21
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Publish mods
run: ./gradlew build publishMods
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 41 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import org.jetbrains.changelog.Changelog

plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
id 'org.jetbrains.changelog' version '2.+'
}

version = project.mod_version
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group

base {
Expand Down Expand Up @@ -61,6 +65,42 @@ jar {
}
}


publishMods {
file = remapJar.archiveFile
type = STABLE
changelog = fetchChangelog()

displayName = "VoteListener ${version.get()}"
modLoaders.add("fabric")
modLoaders.add("quilt")

modrinth {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "Rl1FP1ar"
minecraftVersions.add(project.minecraft_version)
}
github {
accessToken = providers.environmentVariable("GITHUB_TOKEN")
repository = providers.environmentVariable("GITHUB_REPOSITORY").getOrElse("DrexHD/dryrun")
commitish = providers.environmentVariable("GITHUB_REF_NAME").getOrElse("dryrun")
}
}


private String fetchChangelog() {
def log = getChangelog.changelog.get()
if (log.has(project.mod_version)) {
return log.renderItem(
log.get(project.mod_version).withHeader(false),
Changelog.OutputType.MARKDOWN
)
} else {
return ""
}
}


// configure the maven publication
publishing {
publications {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ minecraft_version=1.21
loader_version=0.15.11

# Mod Properties
mod_version=1.1.0+1.21
mod_version=1.1.0
maven_group=me.drex.votelistener
archives_base_name=votelistener

Expand Down

0 comments on commit a087323

Please sign in to comment.