Skip to content

Commit

Permalink
Added curseforge upload
Browse files Browse the repository at this point in the history
  • Loading branch information
yueh committed Sep 14, 2020
1 parent 2ee9b85 commit a86425d
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
- name: Prepare artifact metadata
id: prepare_artifact_metadata
run: |
echo ::set-output name=API_ARTIFACT_PATH::./api/build/libs/metrics-api-${RELEASE}.jar
echo ::set-output name=API_ARTIFACT_PATH::./api/build/libs/api-${RELEASE}.jar
echo ::set-output name=API_ARTIFACT_NAME::metrics-api-${RELEASE}.jar
echo ::set-output name=CORE_ARTIFACT_PATH::./core/build/libs/metrics-core-${RELEASE}.jar
echo ::set-output name=CORE_ARTIFACT_PATH::./core/build/libs/core-${RELEASE}.jar
echo ::set-output name=CORE_ARTIFACT_NAME::metrics-core-${RELEASE}.jar
echo ::set-output name=FABRIC_ARTIFACT_PATH::./fabric/build/libs/metrics-fabric-${RELEASE}.jar
echo ::set-output name=FABRIC_ARTIFACT_PATH::./fabric/build/libs/fabric-${RELEASE}.jar
echo ::set-output name=FABRIC_ARTIFACT_NAME::metrics-fabric-${RELEASE}.jar
echo ::set-output name=FORGE_ARTIFACT_PATH::./forge/build/libs/metrics-forge-${RELEASE}.jar
echo ::set-output name=FORGE_ARTIFACT_PATH::./forge/build/libs/forge-${RELEASE}.jar
echo ::set-output name=FORGE_ARTIFACT_NAME::metrics-forge-${RELEASE}.jar
- name: Upload API Release Artifact
uses: actions/[email protected]
Expand Down Expand Up @@ -75,3 +75,8 @@ jobs:
asset_path: ${{ steps.prepare_artifact_metadata.outputs.FORGE_ARTIFACT_PATH }}
asset_name: ${{ steps.prepare_artifact_metadata.outputs.FORGE_ARTIFACT_NAME }}
asset_content_type: application/zip
- name: Upload to curseforge
env:
CHANGELOG: ${{ github.event.release.body }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
run: ./gradlew curseforge --no-daemon --max-workers 1
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'fabric-loom' version '0.5.25' apply false
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
id "com.diffplug.gradle.spotless" version "4.3.0"
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
}

repositories {
Expand Down
34 changes: 34 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'fabric-loom'
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'com.matthewprenger.cursegradle'

dependencies {
minecraft "com.mojang:minecraft:${project.fabric_minecraft_version}"
Expand All @@ -25,3 +26,36 @@ remapJar {
getInput().set(shadowJar.getArchivePath());
}
remapJar.dependsOn shadowJar

def isAlpha = project.version.contains("alpha")
def isBeta = project.version.contains("beta")

def cfReleaseType = "release"
if (isAlpha) {
cfReleaseType = "alpha"
} else if (isBeta) {
cfReleaseType = "beta"
}

if (System.getenv("CURSEFORGE") && !version.endsWith("-SNAPSHOT")) {
curseforge {
apiKey = System.getenv("CURSEFORGE")
project {
id = project.curseforge_project
changelogType = "markdown"
changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/AppliedEnergistics/MEtrics/releases) for a changelog"
releaseType = cfReleaseType
addGameVersion project.minecraft_version
addGameVersion "Fabric"
mainArtifact(remapJar.archiveFile) {
displayName = "MEtrics ${project.version} [FABRIC]"
}
}
options {
forgeGradleIntegration = false
}
afterEvaluate {
tasks.getByName("curseforge${project.curseforge_project}").dependsOn remapJar
}
}
}
28 changes: 27 additions & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ buildscript {
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.matthewprenger.cursegradle'

sourceSets {
main {
Expand Down Expand Up @@ -120,4 +121,29 @@ jar {
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
//publish.dependsOn('reobfJar')

def isAlpha = project.version.contains("alpha")
def isBeta = project.version.contains("beta")

def cfReleaseType = "release"
if (isAlpha) {
cfReleaseType = "alpha"
} else if (isBeta) {
cfReleaseType = "beta"
}

if (System.getenv("CURSEFORGE")) {
curseforge {
apiKey = System.getenv("CURSEFORGE")
project {
id = project.curseforge_project
changelogType = "markdown"
changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/AppliedEnergistics/MEtrics/releases) for a changelog"
releaseType = cfReleaseType
mainArtifact(jar) {
displayName = "MEtrics ${project.version} [FORGE]"
}
}
}
}
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ forge_version=33.0.42
#########################################################
micrometer_version=1.5.4

#########################################################
# CurseForge #
#########################################################
curseforge_project=407648

#########################################################
# Gradle Settings #
#########################################################
Expand Down

0 comments on commit a86425d

Please sign in to comment.