Skip to content

Commit

Permalink
Update forge/fabric and build scirpt
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaz492 committed Aug 3, 2023
1 parent 79718b4 commit bf654d0
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 58 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ name: Build & Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
build:
if: |
!contains(github.event.head_commit.message, '[ciskip]')
uses: nanite/workflows/.github/workflows/standard-arch-release.yml@v1
uses: nanite/workflows/.github/workflows/[email protected]
with:
java-version: 17
changelog-file: "./CHANGELOG.md"
release-to-github: false
secrets:
nanite-token: ${{ secrets.NANITE_DEPLOY }}
curse-token: ${{ secrets.CURSE_DEPLOY }}
curse-token: ${{ secrets.CURSE_DEPLOY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build & Snapshot

on:
push:
branches:
- "*"

jobs:
build:
if: |
!contains(github.event.head_commit.message, '[ciskip]')
uses: nanite/workflows/.github/workflows/base-java.yml@v1
secrets:
nanite-token: ${{ secrets.NANITE_DEPLOY }}
with:
use-snapshots: true
gradle-tasks: build publish
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## [3.0.2]

- Updated forge and fabric
- Updated build script

## [3.0.1]

- Updated to 1.20.1
Expand Down
69 changes: 65 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
id "me.modmuss50.mod-publish-plugin" version "0.3.0"
}

ext.isSnapshot = providers.environmentVariable("SNAPSHOT").map { it == "true" }.getOrElse(false)

architectury {
minecraft = rootProject.minecraft_version
}
Expand All @@ -27,10 +30,8 @@ allprojects {
apply plugin: "maven-publish"
apply plugin: 'com.matthewprenger.cursegradle'

def ENV = System.getenv()

archivesBaseName = rootProject.archives_base_name
version = "${mod_version}-build.${ENV.GITHUB_RUN_NUMBER ?: 9999}+mc${minecraft_version}"
version = "${mod_version}+mc${minecraft_version}${isSnapshot ? '-SNAPSHOT' : ''}"
group = rootProject.maven_group

repositories {
Expand All @@ -46,4 +47,64 @@ allprojects {
}
}

task curseforgePublish
publishMods {
dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null
changelog = file("./CHANGELOG.md").text
version = "${mod_version}"
type = STABLE

def fabricOptions = publishOptions {
file = project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "${project.name} Fabric ${mod_version}+mc${minecraft_version}"
modLoaders.add("fabric")
}

def forgeOptions = publishOptions {
file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "${project.name} Forge ${mod_version}+mc${minecraft_version}"
modLoaders.add("forge")
}

def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSE_TOKEN")
projectId = "${curseforge_id}"
minecraftVersions.add("${minecraft_version}")
}

def modrinthOptions = modrinthOptions {
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = "${modrinth_id}"
minecraftVersions.add("${minecraft_version}")
}

curseforge("curseforgeFabric") {
from(curseForgeOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

curseforge("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
}


modrinth("modrinthFabric") {
from(modrinthOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}

modrinth("modrinthForge") {
from(modrinthOptions, forgeOptions)
}

github {
file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile }
additionalFiles.from project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
repository = "${github_repo}"
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun")
}
}
24 changes: 1 addition & 23 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,4 @@ publishing {
}
}
}
}

if (ENV.CURSE_TOKEN) {
curseforge {
apiKey = ENV.CURSE_TOKEN
project {
id = project.curseforge_id
releaseType = "release"
addGameVersion "Fabric"
addGameVersion "Java 17"
addGameVersion "${minecraft_version}"
relations {
requiredDependency 'fabric-api'
requiredDependency 'architectury-api'
}
mainArtifact(remapJar)
changelog = file("../CHANGELOG.md")
changelogType = 'markdown'
}
}
}

rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge")
}
23 changes: 1 addition & 22 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,4 @@ publishing {
}
}
}
}

if (ENV.CURSE_TOKEN) {
curseforge {
apiKey = ENV.CURSE_TOKEN
project {
id = project.curseforge_id
releaseType = "release"
addGameVersion "Java 17"
addGameVersion "Forge"
addGameVersion "${minecraft_version}"
relations {
requiredDependency 'architectury-api'
}
mainArtifact(remapJar)
changelog = file("../CHANGELOG.md")
changelogType = 'markdown'
}
}
}

rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge")
}
15 changes: 9 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ minecraft_version=1.20.1
enabled_platforms=fabric,forge

archives_base_name=BambooEverything
mod_version=3.0.1
mod_version=3.0.2
maven_group=dev.wuffs

architectury_version=9.0.8
architectury_version=9.1.12

fabric_loader_version=0.14.21
fabric_api_version=0.83.1+1.20.1
fabric_loader_version=0.14.22
fabric_api_version=0.86.1+1.20.1

forge_version=1.20.1-47.0.1
forge_version=1.20.1-47.1.5

# Publishing
curseforge_id=331723

modrinth_id=cpRkny9R
github_repo=nanite/Bamboo-Everything
maven_url=https://maven.nanite.dev/

0 comments on commit bf654d0

Please sign in to comment.