Skip to content

Commit

Permalink
Setup publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Jun 27, 2023
1 parent b96052e commit 8711c58
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 5 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
Expand All @@ -17,11 +17,21 @@ jobs:
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Artifact
path: ./build/libs/*.jar
- name: Publish the Mod
- name: Publish To Curseforge
if: contains(github.event.head_commit.message, '[publish]') || contains(github.event.head_commit.message, '[curseforge]')
env:
CURSEFORGE_KEY: ${{ secrets.CURSEFORGE_KEY }}
run: ./gradlew curseforge --stacktrace
- name: Publish To Modrinth
if: contains(github.event.head_commit.message, '[publish]') || contains(github.event.head_commit.message, '[modrinth]')
env:
MODRINTH_KEY: ${{ secrets.MODRINTH_KEY }}
run: ./gradlew modrinth --stacktrace
- name: Publish to maven
if: contains(github.event.head_commit.message, '[push]') || contains(github.event.head_commit.message, '[build]')
env:
SAP_SECRET: ${{ secrets.SAP_SECRET }}
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version "2.+"
}

version = "${version}"
Expand Down Expand Up @@ -142,4 +144,7 @@ publishing {

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
}

apply from: 'gradle/curseforge.gradle'
apply from: 'gradle/modrinth.gradle'
Empty file added changelog.md
Empty file.
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ forge_version=43.2.14
mcp_channel=official
mcp_mappings=1.19.2

#Publishing
mod_name=Angry Mobs
curseforge_id=430225
modrinth_id=W9PF5nLR

# Version
version=2.0.0

Expand Down
17 changes: 17 additions & 0 deletions gradle/curseforge.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apply plugin: "com.matthewprenger.cursegradle"

if (System.getenv().CURSEFORGE_KEY) {
curseforge {
apiKey = System.getenv().CURSEFORGE_KEY
project {
id = project.curseforge_id
releaseType = "release"
addGameVersion "Forge"
addGameVersion "${mc_version}"
addGameVersion "Java 17"
mainArtifact(jar)
changelog = file("$project.rootDir/changelog.md")
changelogType = 'markdown'
}
}
}
16 changes: 16 additions & 0 deletions gradle/modrinth.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apply plugin: "com.modrinth.minotaur"

if (System.getenv().MODRINTH_KEY) {
String fileContents = file("$project.rootDir/changelog.md").text
modrinth {
token = System.getenv().MODRINTH_KEY
projectId = project.modrinth_id
versionType = "release"
versionName = "${mod_name} ${mc_version}"
versionNumber = project.version
uploadFile = jar
changelog = fileContents
gameVersions = ["${mc_version}"]
loaders = ["forge"]
}
}

0 comments on commit 8711c58

Please sign in to comment.