Skip to content

Commit

Permalink
Setup publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Sep 16, 2023
1 parent 6ebef11 commit 0e0ca9b
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 15 deletions.
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Bug Report
description: Report an issue you've encountered
labels: [bug]
body:
- type: markdown
attributes:
value: "## Welcome!"
- type: markdown
attributes:
value: |
Thank you for taking your time to report this bug!
Make sure you are running the latest version before reporting.
- type: input
id: description
attributes:
label: Describe the bug
description: "A clear and concise description of what the bug is."
validations:
required: true
- type: textarea
id: repro
attributes:
label: Steps to reproduce
description: |
How do you trigger this bug? Please walk us through it step by step.
If applicable, add screenshots to help explain your problem.
value: |
1.
2.
3.
...
validations:
required: true
- type: input
id: logs
attributes:
label: Logs
description: |
If applicable (crash, error output in console), please provide your crash report or latest.log
To upload logs, use an external site to post the crash report, such as [Ubuntu Pastebin](https://paste.ubuntu.com/), [Pastebin](http://pastebin.com/), or [Github Gist](https://gist.github.com/)
- type: textarea
id: context
attributes:
label: Additional context
description: "Add any other context about the problem here, such as the modpack you're playing or other mods that might be causing this bug."
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: GitHub Discussions
url: https://github.com/Sinytra/ConnectorExtras/discussions
about: Please look here for frequently asked questions and questions on how to use Connector Extras.
- name: Discord
url: https://discord.gg/mamk7z3TKZ
about: Join us on our discord!
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
workflow_dispatch:
inputs:
release_type:
description: 'The published artifact release type'
required: false
default: 'STABLE'
type: choice
options:
- STABLE
- BETA
- ALPHA

permissions:
actions: read
contents: write

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: FabricMC/fabric-action-scripts@v2
id: changelog
with:
context: changelog
workflow_id: release.yml
- uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
- uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
gradle-home-cache-excludes: |
gradle.properties
- name: Build with Gradle
run: ./gradlew clean build publishMods --stacktrace
env:
PUBLISH_RELEASE_TYPE: ${{ inputs.release_type }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Connector Extras

[![Build](https://github.com/Sinytra/ConnectorExtras/actions/workflows/build.yml/badge.svg)](https://github.com/Sinytra/ConnectorExtras/actions/workflows/build.yml)
[![GitHub Releases](https://img.shields.io/github/v/release/Sinytra/ConnectorExtras?style=flat&label=Release&include_prereleases&sort=semver)](https://github.com/Sinytra/ConnectorExtras/releases/latest)
[![CurseForge](https://cf.way2muchnoise.eu/title/connector-extras.svg)](https://legacy.curseforge.com/minecraft/mc-mods/connector-extras)
[![Modrinth](https://img.shields.io/modrinth/dt/FYpiwiBR?color=00AF5C&label=modrinth&style=flat&logo=modrinth)](https://modrinth.com/mod/connector-extras)
[![Discord](https://discordapp.com/api/guilds/1141048834177388746/widget.png?style=shield)](https://discord.gg/mamk7z3TKZ)

Expand Down
56 changes: 42 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import me.modmuss50.mpp.ReleaseType
import net.fabricmc.loom.util.FileSystemUtil
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.StandardCopyOption

plugins {
java
`maven-publish`
id("dev.architectury.loom") version "1.3-SNAPSHOT"
id("me.modmuss50.mod-publish-plugin") version "0.3.+"
id("net.neoforged.gradleutils") version "2.0.+"
}

val versionMc: String by rootProject
val versionForge: String by rootProject
val versionConnectorExtras: String by rootProject
val curseForgeId: String by project
val modrinthId: String by project
val githubRepository: String by project
val publishBranch: String by project
val connectorCurseForge: String by project
val connectorModrinth: String by project

val CI: Provider<String> = providers.environmentVariable("CI")

group = "dev.su5ed.sinytra"
version = "$versionConnectorExtras+$versionMc"
// Append git commit hash for dev versions
if (!CI.isPresent) {
version = "$version+dev-${gradleutils.gitInfo["hash"]}"
}
println("Project version: $version")

allprojects {
apply(plugin = "java")
Expand Down Expand Up @@ -76,21 +93,32 @@ tasks.remapJar {
finalizedBy(relocateNestedJars)
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
publishMods {
file.set(tasks.jar.flatMap { it.archiveFile })
changelog.set(providers.environmentVariable("CHANGELOG").orElse("# $version"))
type.set(providers.environmentVariable("PUBLISH_RELEASE_TYPE").orElse("alpha").map(ReleaseType::of))
modLoaders.add("forge")
dryRun.set(!CI.isPresent)

github {
accessToken.set(providers.environmentVariable("GITHUB_TOKEN"))
repository.set(githubRepository)
commitish.set(publishBranch)
}
curseforge {
accessToken.set(providers.environmentVariable("CURSEFORGE_TOKEN"))
projectId.set(curseForgeId)
minecraftVersions.add(versionMc)
requires {
slug.set(connectorCurseForge)
}
}

repositories {
maven {
name = "Su5eD"
url = uri("https://maven.su5ed.dev/releases")
credentials {
username = System.getenv("MAVEN_USER") ?: "not"
password = System.getenv("MAVEN_PASSWORD") ?: "set"
}
modrinth {
accessToken.set(providers.environmentVariable("MODRINTH_TOKEN"))
projectId.set(modrinthId)
minecraftVersions.add(versionMc)
requires {
id.set(connectorModrinth)
}
}
}
14 changes: 13 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G

loom.platform=forge

# Versions
versionMc=1.20.1
versionForge=47.1.3
versionConnectorExtras=1.0.0

# Publishing
curseForgeId=913445
modrinthId=FYpiwiBR
githubRepository=Sinytra/ConnectorExtras
publishBranch=master

loom.platform=forge
# Dependencies
connectorCurseForge=connector
connectorModrinth=u58R1TMW
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ pluginManagement {
name = "MinecraftForge"
url = uri("https://maven.minecraftforge.net")
}
maven {
name = "NeoForged"
url = uri("https://maven.neoforged.net")
}
maven {
name = "Sponge Snapshots"
url = uri("https://repo.spongepowered.org/repository/maven-public")
Expand Down

0 comments on commit 0e0ca9b

Please sign in to comment.