Skip to content

Commit

Permalink
setup ci
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed Jan 27, 2024
1 parent 4a4bd8b commit a4a370d
Show file tree
Hide file tree
Showing 11 changed files with 208 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,7 @@ ij_json_wrap_long_lines = false

[{*.kt,*.kts}]
ij_continuation_indent_size = 4

[{*.yml,*.yaml}]
indent_size = 2
tab_width = 2
36 changes: 36 additions & 0 deletions .github/workflows/head.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: head
on:
push:
branches:
- '**'
tags-ignore:
- '*.*'
pull_request:
branches:
- '**'
tags-ignore:
- '*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: vars
run: |
echo "git_hash=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- run: chmod +x gradlew
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-${{ github.ref }}-${{ hashFiles('**/*.gradle.kts') }}
- run: ./gradlew build
env:
GIT_HASH: ${{ steps.vars.outputs.git_hash }}
- uses: actions/upload-artifact@v3
with:
name: megane-${{ steps.vars.outputs.git_hash }}
path: "./modules/**/build/libs/**.jar"
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release
on:
push:
tags: "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: vars
run: |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- run: chmod +x gradlew
- run: ./gradlew build publishMods
env:
MOD_VERSION: ${{ steps.vars.outputs.version }}
CURSEFORGE_API: ${{ secrets.CURSEFORGE_API }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: megane-${{ steps.vars.outputs.git_hash }}
path: "./modules/**/build/libs/**.jar"
- uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: |
[
"./modules/*/build/libs/*[0-9.].jar",
"./modules/*/*/build/libs/*[0-9.].jar",
]
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import java.nio.charset.StandardCharsets
plugins {
java
id("lol.bai.explosion") version "0.1.0" apply false
id("me.modmuss50.mod-publish-plugin") version "0.4.5" apply false
}

group = "lol.bai.megane"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/GenModsTomlTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ abstract class GenModsTomlTask : DefaultTask() {
put("modId", id)
put("version", "${project.version}")
put("authors", "deirn")
put("logoFile", "megane.jpg")
put("logoFile", "megane.png")

if (contributors.get().isNotEmpty()) {
put("credits", contributors.get().joinToString(separator = ", "))
Expand Down
7 changes: 5 additions & 2 deletions buildSrc/src/main/kotlin/Uploads.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ object cfIds {
}

object cfSlugs {
val wthit = "wthit"
val wthitFabric = "wthit"
val wthitForge = "wthit-forge"
val ae2 = "applied-energistics-2"
val alloyForge = "alloy-forgery"
val createFabric = "create-fabric"
val createForge = "create"
val dml = "deep-mob-learning-refabricated"
val extraGen = "extra-generators"
val ie = "immersive-engineering"
val indrev = "industrial-revolution"
val kibe = "kibe"
val lba = "libblockattributes"
Expand All @@ -39,8 +42,8 @@ object mrIds {
val ae2 = "XxWD5pD3"
val alloyForge = "jhl28YkY"
val architectury = "lhGA9TYQ"
val createForge = "LNytGWDc"
val createFabric = "Xbc0uyRg"
val createForge = "LNytGWDc"
val dml = "osuPHzT3"
val clothConfig = "9s6osm5g"
val cofhCore = "OWSRM4vD"
Expand Down
65 changes: 65 additions & 0 deletions modules/fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
import me.modmuss50.mpp.ReleaseType

plugins {
id("fabric-loom") version "1.3.+"

id("me.modmuss50.mod-publish-plugin")
}

publishMods {
changelog.set("https://github.com/badasintended/megane/releases/tag/${project.version}")
type.set(ReleaseType.STABLE)
modLoaders.add("fabric")

val curseForgeApi = providers.environmentVariable("CURSEFORGE_API")
val modrinthToken = providers.environmentVariable("MODRINTH_TOKEN")
dryRun.set(!(curseForgeApi.isPresent && modrinthToken.isPresent))

curseforge {
projectId.set("408118")
accessToken.set(curseForgeApi)
minecraftVersions.add("1.19.2")

requires(cfSlugs.wthitFabric)
optional(
cfSlugs.alloyForge,
cfSlugs.ae2,
cfSlugs.createFabric,
cfSlugs.dml,
cfSlugs.extraGen,
cfSlugs.indrev,
cfSlugs.kibe,
cfSlugs.luggage,
cfSlugs.modernDynamics,
cfSlugs.powah,
cfSlugs.rebornCore,
cfSlugs.techReborn,
cfSlugs.wirelessNet,
)
}

modrinth {
projectId.set("ZNk5S5U6")
accessToken.set(modrinthToken)
minecraftVersions.add("1.19.2")

requires(mrIds.wthit)
optional(
mrIds.alloyForge,
mrIds.ae2,
mrIds.createFabric,
mrIds.dml,
mrIds.extraGen,
mrIds.kibe,
mrIds.modernDynamics,
mrIds.powah,
)
}
}

allprojects {
Expand Down Expand Up @@ -68,4 +123,14 @@ afterEvaluate {
}
}
}

publishMods {
file.set(tasks.jar.get().archiveFile)
}
}

subprojects {
base {
archivesName.set("megane-fabric-${project.name}")
}
}
5 changes: 4 additions & 1 deletion modules/forge/applied-energistics-2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ metadata("lol.bai.megane.module.ae2") {

forgeFml()
packMcmeta()
modsToml()

modsToml {
depends("ae2" to any)
}
}

repositories {
Expand Down
49 changes: 49 additions & 0 deletions modules/forge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,48 @@
import groovy.lang.GroovyObject
import me.modmuss50.mpp.ReleaseType
import net.minecraftforge.gradle.common.util.RunConfig

plugins {
id("net.minecraftforge.gradle") version "[6.0.16, 6.2)"
id("org.spongepowered.mixin") version "0.7.+"

id("me.modmuss50.mod-publish-plugin")
}

publishMods {
changelog.set("https://github.com/badasintended/megane/releases/tag/${project.version}")
type.set(ReleaseType.STABLE)
modLoaders.add("forge")

val curseForgeApi = providers.environmentVariable("CURSEFORGE_API")
val modrinthToken = providers.environmentVariable("MODRINTH_TOKEN")
dryRun.set(!(curseForgeApi.isPresent && modrinthToken.isPresent))

curseforge {
projectId.set("965089")
accessToken.set(curseForgeApi)
minecraftVersions.add("1.19.2")

requires(cfSlugs.wthitForge)
optional(
cfSlugs.ae2,
cfSlugs.createForge,
cfSlugs.ie
)
}

modrinth {
projectId.set("pcvCiEEP")
accessToken.set(modrinthToken)
minecraftVersions.add("1.19.2")

requires(mrIds.wthit)
optional(
mrIds.ae2,
mrIds.createForge,
mrIds.ie
)
}
}

allprojects {
Expand Down Expand Up @@ -120,6 +159,10 @@ tasks {
mergeWaila.input.add(genWaila.output)
}
}

project.publishMods {
file.set(fatJar.archiveFile)
}
}

subprojects.forEach { sub ->
Expand All @@ -143,3 +186,9 @@ subprojects.forEach { sub ->
}
}
}

subprojects {
base {
archivesName.set("megane-forge-${project.name}")
}
}
5 changes: 4 additions & 1 deletion modules/forge/create/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ metadata("lol.bai.megane.module.create") {
forgeFml()
packMcmeta()
language()
modsToml()

modsToml{
depends("create" to any)
}
}

dependencies {
Expand Down
5 changes: 4 additions & 1 deletion modules/forge/immersive-engineering/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ metadata("lol.bai.megane.module.ie") {
forgeFml()
packMcmeta()
language()
modsToml()

modsToml{
depends("immersiveengineering" to any)
}
}

dependencies {
Expand Down

0 comments on commit a4a370d

Please sign in to comment.