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

Commit

Permalink
Update publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
melontini committed Aug 2, 2024
1 parent d539c4b commit 3176c25
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 112 deletions.
73 changes: 4 additions & 69 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,9 @@

name: build
on:
push:
workflow_dispatch:
inputs:
version_type:
description: "The type of this version. e.g alpha"
type: choice
default: beta
options:
- release
- beta
- alpha
required: false
on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest
if: |
!contains(github.event.head_commit.message, '[ci skip]')
steps:
- name: checkout repository
uses: actions/checkout@v4.1.1
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2.1.1
- name: setup jdk 17
uses: actions/setup-java@v4.1.0
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build and publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build publish
- name: get version #https://stackoverflow.com/questions/71089787/how-to-get-version-name-from-android-gradle-file-in-github-actions
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "VERSION_INFORMATION=$(${{github.workspace}}/gradlew -q printVersionName)" >> $GITHUB_ENV
echo "VERSION_PLAIN=$(${{github.workspace}}/gradlew -q printVersion)" >> $GITHUB_ENV
- name: publish release
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: Kir-Antipov/mc-publish@v3.3.0
with:
version-type: ${{ inputs.version_type }}
changelog-file: CHANGELOG.md
name: ${{ env.VERSION_INFORMATION }}
version: ${{ env.VERSION_PLAIN }}

game-versions: |
>=1.18 <=1.20.4
loaders: |
fabric
java: |
17
github-tag: ${{ env.VERSION_PLAIN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-commitish: ${{ github.sha }}
github-prerelease: false

modrinth-id: 6N4iGk9g
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset
modrinth-dependencies: |
dark-matter(embedded)
uses: constellation-mc/actions/.github/workflows/gradle-build.yml@main
with:
java: 17
23 changes: 0 additions & 23 deletions .github/workflows/build_pr.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

name: publish
on:
workflow_dispatch:
inputs:
version_type:
description: "The type of this version. e.g alpha"
type: choice
default: BETA
options:
- STABLE
- BETA
- ALPHA
- NONE
required: false

jobs:
publish:
uses: constellation-mc/actions/.github/workflows/mc-publish.yml@main
with:
java: 17
version_type: ${{ inputs.version_type }}
secrets: inherit
70 changes: 53 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import me.modmuss50.mpp.ReleaseType

plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
alias libs.plugins.fabric.loom
id 'maven-publish'
alias libs.plugins.spotless
alias libs.plugins.modmuss50.publish
}

def local = !System.getenv().containsKey("GITHUB_RUN_NUMBER")
Expand All @@ -21,11 +25,12 @@ dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation libs.fabric.loader

def dmModules = ["base", "instrumentation"]
for (final def module in dmModules) {
modApi include("me.melontini:dark-matter-${module}:${project.dark_matter}")
def dm = libs.dark.matter
[dm.base, dm.instrumentation].each {
modApi it
include it
}
}

Expand Down Expand Up @@ -62,18 +67,6 @@ java {
withSourcesJar()
}

tasks.register('printVersionName') {
doLast {
println project.mod_version + " (1.18-1.21)"
}
}

tasks.register('printVersion') {
doLast {
println version
}
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
Expand All @@ -100,3 +93,46 @@ publishing {
}
}
}

publishMods {
file = remapJar.archiveFile
additionalFiles.from(remapSourcesJar.archiveFile)

changelog = file("CHANGELOG.md").text
type = ReleaseType.valueOf(providers.environmentVariable("VERSION_TYPE").getOrElse("BETA"))
modLoaders.add("fabric")

displayName = "${project.mod_version} (1.18-1.21)"

modrinth {
projectId = "6N4iGk9g"
accessToken = providers.environmentVariable("MODRINTH_TOKEN")

minecraftVersionRange {
start = "1.18"
end = "latest"
}

embeds("dark-matter")
}
curseforge {
projectId = "850931"
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")

minecraftVersionRange {
start = "1.18"
end = "latest"
}

embeds("dark-matter")
}
github {
repository = "constellation-mc/blame-log"
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = providers.environmentVariable("GITHUB_SHA").orElse("multi-version-fabric")

type = STABLE
}

dryRun = local
}
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ org.gradle.jvmargs=-Xmx2G
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.16.0
# Mod Properties
mod_version=0.5.0
maven_group=me.melontini
archives_base_name=blame-log
# Dependencies
dark_matter=4.1.1-1.20.1-build.90

13 changes: 13 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[versions]
dark-matter = "4.1.1-1.20.1-build.90"

[libraries]
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version = "0.16.0" }

dark-matter-base = { group = "me.melontini", name = "dark-matter-base", version.ref = "dark-matter" }
dark-matter-instrumentation = { group = "me.melontini", name = "dark-matter-instrumentation", version.ref = "dark-matter" }

[plugins]
fabric-loom = { id = "fabric-loom", version = "1.7.2" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
modmuss50-publish = { id = "me.modmuss50.mod-publish-plugin", version = "0.6.2" }

0 comments on commit 3176c25

Please sign in to comment.