Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 5e558a6

Browse files
committed
build.gradle and actions update
1 parent f71de6f commit 5e558a6

File tree

7 files changed

+167
-162
lines changed

7 files changed

+167
-162
lines changed

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
registries:
3+
fabric:
4+
url: "https://maven.fabricmc.net/"
5+
type: maven-repository
6+
gradle-plugins:
7+
url: "https://plugins.gradle.org/m2/"
8+
type: maven-repository
9+
maven-central:
10+
url: "https://repo1.maven.org/maven2/"
11+
type: maven-repository
12+
13+
updates:
14+
- package-ecosystem: gradle
15+
registries:
16+
- fabric
17+
- gradle-plugins
18+
- maven-central
19+
ignore:
20+
- dependency-name: me.melontini:dark-matter*
21+
- dependency-name: net.fabricmc.fabric-api:fabric-api
22+
directory: /
23+
schedule:
24+
interval: weekly

.github/workflows/build.yml

Lines changed: 12 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,17 @@
11

22
name: build
3-
on:
4-
push:
5-
workflow_dispatch:
6-
inputs:
7-
version_type:
8-
description: "The type of this version. e.g alpha"
9-
type: choice
10-
default: beta
11-
options:
12-
- release
13-
- beta
14-
- alpha
15-
required: false
3+
on: [ push, pull_request ]
164

175
jobs:
186
build:
19-
runs-on: ubuntu-latest
20-
if: |
21-
!contains(github.event.head_commit.message, '[ci skip]')
22-
outputs:
23-
version_info: ${{ steps.get_version.outputs.version_info }}
24-
version_plain: ${{ steps.get_version.outputs.version_plain }}
25-
game_versions: ${{ steps.get_version.outputs.game_versions }}
26-
steps:
27-
- name: checkout repository
28-
uses: actions/[email protected]
29-
- name: validate gradle wrapper
30-
uses: gradle/[email protected]
31-
- name: setup jdk
32-
uses: actions/[email protected]
33-
with:
34-
distribution: 'temurin'
35-
java-version: 17
36-
cache: gradle
37-
- name: make gradle wrapper executable
38-
run: chmod +x ./gradlew
39-
- name: build
40-
run: ./gradlew build
41-
- name: get version #https://stackoverflow.com/questions/71089787/how-to-get-version-name-from-android-gradle-file-in-github-actions
42-
id: get_version
43-
run: |
44-
echo "version_info=$(${{github.workspace}}/gradlew -q printVersionName)" >> $GITHUB_OUTPUT
45-
echo "version_plain=$(${{github.workspace}}/gradlew -q printVersion)" >> $GITHUB_OUTPUT
46-
echo "game_versions=$(${{github.workspace}}/gradlew -q printGameVersions)" >> $GITHUB_OUTPUT
47-
- name: capture build artifacts
48-
uses: actions/[email protected]
49-
with:
50-
name: Artifacts #https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action
51-
path: build/libs/
52-
53-
packages:
54-
needs: build
55-
runs-on: ubuntu-latest
56-
steps:
57-
- name: checkout repository
58-
uses: actions/[email protected]
59-
- name: setup jdk
60-
uses: actions/[email protected]
61-
with:
62-
distribution: 'temurin'
63-
java-version: 17
64-
cache: gradle
65-
- name: make gradle wrapper executable
66-
run: chmod +x ./gradlew
67-
- name: publish
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70-
run: |
71-
./gradlew publish
72-
73-
publish:
74-
needs: build
75-
runs-on: ubuntu-latest
76-
if: ${{ github.event_name == 'workflow_dispatch' }}
77-
steps:
78-
- name: checkout repository
79-
uses: actions/[email protected]
80-
- uses: actions/[email protected]
81-
with:
82-
name: Artifacts
83-
path: build/libs
84-
85-
- name: publish release
86-
uses: Kir-Antipov/[email protected]
87-
with:
88-
version-type: ${{ inputs.version_type }}
89-
changelog-file: CHANGELOG.md
90-
name: ${{ needs.build.outputs.version_info }}
91-
version: ${{ needs.build.outputs.version_plain }}
92-
93-
game-versions: |
94-
${{ needs.build.outputs.game_versions }}
95-
96-
loaders: |
97-
fabric
98-
99-
java: |
100-
17
101-
102-
github-tag: v${{ needs.build.outputs.version_plain }}
103-
github-token: ${{ secrets.GITHUB_TOKEN }}
104-
github-commitish: ${{ github.sha }}
105-
github-prerelease: false
106-
107-
modrinth-id: sc4Mu9Zu
108-
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
109-
modrinth-featured: true
110-
modrinth-unfeature-mode: subset
111-
modrinth-dependencies: |
112-
fabric-api(required)
113-
dark-matter(embedded)
7+
uses: constellation-mc/actions/.github/workflows/gradle-build.yml@main
8+
with:
9+
java: 17
10+
gradle_tasks: spotbugs
11+
reviewdog: |
12+
cat ./build/reports/spotbugs/main/spotbugs.sarif | reviewdog -name="spotbugs" -f=sarif -reporter=github-check -level=warning
13+
14+
run_tests:
15+
uses: constellation-mc/actions/.github/workflows/mc-tests.yml@main
16+
with:
17+
java: 17

.github/workflows/build_pr.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
name: publish
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_type:
7+
description: "The type of this version. e.g alpha"
8+
type: choice
9+
default: BETA
10+
options:
11+
- STABLE
12+
- BETA
13+
- ALPHA
14+
- NONE
15+
required: false
16+
17+
jobs:
18+
publish:
19+
uses: constellation-mc/actions/.github/workflows/mc-publish.yml@main
20+
with:
21+
java: 17
22+
version_type: ${{ inputs.version_type }}
23+
secrets: inherit

build.gradle

Lines changed: 93 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
import com.github.spotbugs.snom.SpotBugsTask
2+
import me.modmuss50.mpp.ReleaseType
3+
14
plugins {
2-
id 'fabric-loom' version '1.6-SNAPSHOT'
5+
alias libs.plugins.fabric.loom
36
id 'maven-publish'
7+
alias libs.plugins.lombok
8+
alias libs.plugins.spotbugs.base
9+
alias libs.plugins.spotless
10+
alias libs.plugins.modmuss50.publish
411
}
512

613
def local = !System.getenv().containsKey("GITHUB_RUN_NUMBER")
@@ -19,20 +26,57 @@ dependencies {
1926
// To change the versions see the gradle.properties file
2027
minecraft "com.mojang:minecraft:${project.minecraft_version}"
2128
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
22-
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
29+
modImplementation libs.fabric.loader
2330

2431
// Fabric API. This is technically optional, but you probably want it anyway.
25-
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
26-
modApi include("me.melontini:dark-matter-base:${project.dark_matter_version}")
32+
modImplementation libs.fabric.api
33+
modApi libs.dark.matter.base
34+
include libs.dark.matter.base
35+
}
36+
37+
tasks.register("spotbugs", SpotBugsTask) { task ->
38+
sourceSets.each {
39+
task.sourceDirs.from(task.sourceDirs.files, it.allSource.sourceDirectories)
40+
task.classDirs.from(task.classDirs.files, it.output)
41+
task.auxClassPaths.from(task.auxClassPaths.files, it.compileClasspath)
42+
}
43+
excludeFilter = file("spotbugs.xml")
44+
ignoreFailures = true
45+
reports {
46+
if (local) {
47+
html {
48+
required = true
49+
outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.html")
50+
stylesheet = 'fancy-hist.xsl'
51+
}
52+
} else {
53+
sarif {
54+
required = true
55+
outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.sarif")
56+
}
57+
}
58+
}
59+
}
60+
61+
spotless {
62+
java {
63+
removeUnusedImports()
64+
trimTrailingWhitespace()
65+
formatAnnotations()
66+
importOrder('', 'java|javax', '\\#')
67+
}
2768
}
2869

2970
processResources {
30-
inputs.property "version", project.version
31-
inputs.property "loader_version", project.loader_version
71+
def map = [
72+
"version": project.version,
73+
"loader_version": libs.fabric.loader.get().version
74+
]
75+
inputs.properties(map)
76+
filteringCharset "UTF-8"
3277

3378
filesMatching("fabric.mod.json") {
34-
expand "version": project.version,
35-
"loader_version": project.loader_version
79+
expand map
3680
}
3781
}
3882

@@ -62,22 +106,11 @@ jar {
62106
}
63107
}
64108

65-
tasks.register('printGameVersions') {
66-
doLast {
67-
println project.game_versions
68-
}
69-
}
70-
71-
tasks.register('printVersionName') {
72-
doLast {
73-
println version.split("-")[0] + " (" + project.game_versions.replace(" ", "-").replaceAll("[>=<]", "") + ")"
74-
}
75-
}
76-
77-
tasks.register('printVersion') {
78-
doLast {
79-
println version
109+
sourcesJar {
110+
exclude {
111+
sourceSets.main.allSource.contains it.file
80112
}
113+
from delombok
81114
}
82115

83116
// configure the maven publication
@@ -100,3 +133,40 @@ publishing {
100133
}
101134
}
102135
}
136+
137+
publishMods {
138+
file = remapJar.archiveFile
139+
additionalFiles.from(remapSourcesJar.archiveFile)
140+
141+
changelog = file("CHANGELOG.md").text
142+
type = ReleaseType.valueOf(providers.environmentVariable("VERSION_TYPE").getOrElse("BETA"))
143+
modLoaders.add("fabric")
144+
145+
displayName = "${project.mod_version} (${project.minecraft_version})"
146+
147+
modrinth {
148+
projectId = "sc4Mu9Zu"
149+
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
150+
minecraftVersions.add("${project.minecraft_version}")
151+
152+
requires("fabric-api")
153+
embeds("dark-matter")
154+
}
155+
curseforge {
156+
projectId = "622736"
157+
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
158+
minecraftVersions.add("${project.minecraft_version}")
159+
160+
requires("fabric-api")
161+
embeds("dark-matter")
162+
}
163+
github {
164+
repository = "constellation-mc/Linkart"
165+
accessToken = providers.environmentVariable("GITHUB_TOKEN")
166+
commitish = providers.environmentVariable("GITHUB_SHA").getOrElse("${project.minecraft_version}-fabric")
167+
168+
type = STABLE
169+
}
170+
171+
dryRun = local
172+
}

gradle.properties

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ org.gradle.jvmargs=-Xmx1G
44
# check these on https://fabricmc.net/versions.html
55
minecraft_version=1.20.2
66
yarn_mappings=1.20.2+build.4
7-
loader_version=0.15.7
87
# Mod Properties
98
mod_version=5.4.4
109
maven_group=com.github.vini2003.linkart
1110
archives_base_name=linkart
12-
# Dependencies
13-
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api (or https://fabricmc.net/versions.html)
14-
fabric_version=0.90.0+1.20.2
15-
dark_matter_version=4.0.0-1.20.1-build.481
16-
17-
# Publishing
18-
game_versions=>=1.19.2 <=1.20.4

gradle/libs.versions.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[versions]
2+
dark-matter = "4.0.0-1.20.1-build.481"
3+
4+
[libraries]
5+
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version = "0.15.11" }
6+
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version = "0.90.0+1.20.2" }
7+
8+
dark-matter-base = { group = "me.melontini", name = "dark-matter-base", version.ref = "dark-matter" }
9+
10+
[plugins]
11+
fabric-loom = { id = "fabric-loom", version = "1.6.11" }
12+
lombok = { id = "io.freefair.lombok", version = "8.6"}
13+
spotbugs-base = { id = "com.github.spotbugs-base", version = "6.0.14" }
14+
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
15+
modmuss50-publish = { id = "me.modmuss50.mod-publish-plugin", version = "0.5.1" }

0 commit comments

Comments
 (0)