Skip to content

Commit

Permalink
Publishing Workflow, Changelog and Readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Jan 30, 2025
1 parent 3ac29c6 commit c81712e
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 31 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]
on: [ pull_request, push ]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
21, # Current Java LTS
]
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: checkout repository
- name: Checkout repository
uses: actions/checkout@v4
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: setup jdk ${{ matrix.java }}
- name: Validate gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
distribution: 'adopt'
java-version: 21
- name: Make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
- name: Build
run: ./gradlew build
- name: capture build artifacts
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java

- name: Upload build artifacts
if: ${{ github.event_name == 'push' }} # Only upload artifacts on push
uses: actions/upload-artifact@v4
with:
name: Artifacts
name: build-artifacts
path: build/libs/
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish Release

on:
workflow_dispatch:
inputs:
releaseType:
type: choice
description: Release Type
options:
- stable
- beta
- alpha

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Java
run: echo "JAVA_HOME=$JAVA_HOME_21_X64" >> "$GITHUB_ENV"

- name: Loom Cache
uses: actions/cache@v4
with:
path: "**/.gradle/loom-cache"
key: "${{ runner.os }}-gradle-loom-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}"
restore-keys: "${{ runner.os }}-gradle-loom-"
- name: ModDevGradle Cache
uses: actions/cache@v4
with:
path: "**/.gradle/repositories"
key: "${{ runner.os }}-gradle-mdg-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}"
restore-keys: "${{ runner.os }}-gradle-mdg-"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true
cache-read-only: true

- name: Validate Gradle Wrapper Integrity
uses: gradle/wrapper-validation-action@v2

- name: make gradle wrapper executable
run: chmod +x gradlew

- name: Gradle Release Build
env:
RELEASE_WORKFLOW: true
run: ./gradlew build

- name: Set environment variables
run: |
echo "MINECRAFT_VERSION=$(./gradlew -q printMinecraftVersion)" >> $GITHUB_ENV
echo "MOD_VERSION=$(./gradlew -q printModVersion)" >> $GITHUB_ENV
echo "MIN_MINECRAFT_VERSION=$(./gradlew -q printMinMinecraftVersion)" >> $GITHUB_ENV
echo "MAX_MINECRAFT_VERSION=$(./gradlew -q printMaxMinecraftVersion)" >> $GITHUB_ENV
- name: Replace placeholders in CHANGELOG.md
run: |
sed -i 's/_ReleaseTag_/mc${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}/g' CHANGELOG.md
sed -i 's/_MCVersion_/${{ env.MINECRAFT_VERSION }}/g' CHANGELOG.md
sed -i 's/_ModVersion_/${{ env.MOD_VERSION }}/g' CHANGELOG.md
sed -i 's/_MinMCVersion_/${{ env.MIN_MINECRAFT_VERSION }}/g' CHANGELOG.md
sed -i 's/_MaxMCVersion_/${{ env.MAX_MINECRAFT_VERSION }}/g' CHANGELOG.md
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create mc${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }} \
--title="${{ env.RELEASE_NAME }}" \
--notes-file=CHANGELOG.md \
--target=${{ github.ref_name }} \
--draft=false \
--prerelease=${{ inputs.releaseType != 'stable' }} \
build/libs/*.jar
- name: Build & Publish
env:
RELEASE_TYPE: ${{ inputs.releaseType }}
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
run: ./gradlew publishMods
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rail Placement Fix _ModVersion_ for Minecraft versions _MinMCVersion_ - _MaxMCVersion_ adds a new fix for the orientation of all player placed rails.
Please report any rail-related issues you encounter to the [issue tracker of Rail Placement Fix](https://github.com/2No2Name/rail-placement-fix/issues).

## Additions:

- Fix player placed rails trying to connect to partially connected straight rails
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

# Rail Placement Fix

Rail Placement Fix is a Minecraft mod that allows you to place rails more precisely. By sneaking and looking at the corner of a block, you can place curved rails or place sloped rails like a top-side slab. This mod enables you to create any rail pattern you like without changing the shape of neighboring rails.
Rail Placement Fix is a Minecraft mod that allows you to place rails more precisely. By sneaking and looking at the corner of a block, you can place curved rails or place sloped rails like a top-side slab. This mod makes placing rails intuitive and enables you to create any rail pattern you like.

## Features

- Place curved rails by sneaking and looking at the corner of a block.
- Place sloped rails like a top-side slab.
- Maintain the shape of neighboring rails while placing new rails.
- Place sloped rails like a top-side slab when sneaking.
- Maintain the shape of neighboring rails while placing new rails when sneaking.
- Improved and non-directional rail connectivity with partially connected straight rails when manually placing rails.

## Installation

Expand All @@ -21,4 +22,5 @@ Must be installed on the server to work in multiplayer. For usage in singleplaye

- To place a curved rail, sneak and look at the corner of a block where you want to place the rail.
- To place a sloped rail, sneak and place the rail like a top-side slab.
- To avoid modifying neighboring rails, sneak while placing any rail.
- To avoid modifying neighboring rails, sneak while placing any rail.
- To use the improved rail connectivity, place a rail next to a straight rail (powered, activator or detector rail) that is connected to another rail at only one side.
109 changes: 108 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import me.modmuss50.mpp.ReleaseType

plugins {
id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish'
id "me.modmuss50.mod-publish-plugin" version "0.8.3"
}

version = project.mod_version
Expand Down Expand Up @@ -73,4 +76,108 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}

publishMods {
changelog = rootProject.file("CHANGELOG.md").getText().trim()
type = getReleaseType()
file = remapJar.archiveFile

def mod_version = "${project.mod_version}"
def fabric_mod_version = mod_version + "-fabric"
def fabric_suffix = "for Fabric"
def displayNamePrefix = project.property('mod_name').toString()
def cfDisplayNamePrefix = displayNamePrefix + " " + mod_version
def mrDisplayNamePrefix = displayNamePrefix + " " + project.property('mod_version').toString()

// CurseForge options used by both Fabric and Forge
def cfOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
projectId = "1167567"

if (project.hasProperty('minecraft_version_range_start') && project.hasProperty('minecraft_version_range_end')) {
minecraftVersionRange {
start = project.property('minecraft_version_range_start').toString()
end = project.property('minecraft_version_range_end').toString()
}
} else {
minecraftVersions.add(project.property('minecraft_version').toString())
}
}

// Modrinth options used by both Fabric and Forge
def mrOptions = modrinthOptions {
accessToken = providers.environmentVariable("MODRINTH_API_KEY")
projectId = "7z0IZqoa"


if (project.hasProperty('minecraft_version_range_start') && project.hasProperty('minecraft_version_range_end')) {
minecraftVersionRange {
start = project.property('minecraft_version_range_start').toString()
end = project.property('minecraft_version_range_end').toString()
}
} else {
minecraftVersions.add(project.property('minecraft_version').toString())
}
}

// Fabric specific options for CurseForge
curseforge("curseforgeFabric") {
from cfOptions
modLoaders.add("fabric")
modLoaders.add("quilt")
version = fabric_mod_version
displayName = cfDisplayNamePrefix + " " + fabric_suffix
}

// Fabric specific options for Modrinth
modrinth("modrinthFabric") {
from mrOptions
modLoaders.add("fabric")
modLoaders.add("quilt")
version = fabric_mod_version
displayName = mrDisplayNamePrefix + " " + fabric_suffix
}
}

def getReleaseType() {
def releaseType = System.getenv("RELEASE_TYPE")
switch (releaseType) {
case "alpha":
return ReleaseType.ALPHA
case "beta":
return ReleaseType.BETA
case "stable":
return ReleaseType.STABLE
default:
if (releaseType != null) {
throw new IllegalArgumentException("Release type must be alpha, beta or stable!")
}
return ReleaseType.STABLE
}
}

tasks.register("printMinecraftVersion") {
doLast {
println project.minecraft_version
}
}

tasks.register("printMinMinecraftVersion") {
doLast {
println project.minecraft_version_range_start
}
}

tasks.register("printMaxMinecraftVersion") {
doLast {
println project.minecraft_version_range_end
}
}

tasks.register("printModVersion") {
doLast {
println project.mod_version
}
}

5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ loader_version=0.16.9
# Mod Properties
mod_version=1.1.0
maven_group=no2.railplacementfix
archives_base_name=rail-placement-fix
archives_base_name=rail-placement-fix
mod_name=Rail Placement Fix
minecraft_version_range_start=1.17
minecraft_version_range_end=1.21.4
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "rail-placement-fix",
"version": "${version}",
"name": "Rail Placement Fix",
"description": "Rail Placement Fix is a Minecraft mod that allows you to place rails more precisely. By sneaking and looking at the corner of a block, you can place curved rails or place sloped rails like a top-side slab. This mod enables you to create any rail pattern you like without changing the shape of neighboring rails.",
"description": "Rail Placement Fix allows you to place rails more precisely. By sneaking and looking at the corner of a block, you can place curved rails or place sloped rails like a top-side slab. This mod makes placing rails intuitive and enables you to create any rail pattern you like.",
"authors": [
"2No2Name"
],
Expand Down

0 comments on commit c81712e

Please sign in to comment.