Skip to content

Commit 2ad110b

Browse files
Release 2.0.4 with 1.21.11 support and Modrinth automation
1 parent 13185ba commit 2ad110b

11 files changed

Lines changed: 491 additions & 36 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: release-modrinth
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
changelog:
10+
description: "Optional changelog text (overrides tag annotation)"
11+
required: false
12+
type: string
13+
version_type:
14+
description: "Modrinth version type"
15+
required: false
16+
default: "release"
17+
type: choice
18+
options:
19+
- release
20+
- beta
21+
- alpha
22+
status:
23+
description: "Modrinth visibility status"
24+
required: false
25+
default: "listed"
26+
type: choice
27+
options:
28+
- listed
29+
- unlisted
30+
- draft
31+
- archived
32+
featured:
33+
description: "Feature this version"
34+
required: false
35+
default: false
36+
type: boolean
37+
38+
jobs:
39+
publish:
40+
runs-on: ubuntu-24.04
41+
permissions:
42+
contents: read
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
49+
- name: Set up JDK 21
50+
uses: actions/setup-java@v4
51+
with:
52+
java-version: "21"
53+
distribution: "microsoft"
54+
55+
- name: Make release script executable
56+
run: chmod +x scripts/publish_modrinth.sh
57+
58+
- name: Validate tag matches gradle.properties
59+
if: startsWith(github.ref, 'refs/tags/')
60+
run: |
61+
set -euo pipefail
62+
TAG_VERSION="${GITHUB_REF_NAME#v}"
63+
MOD_VERSION="$(awk -F= '$1=="mod_version"{print $2}' gradle.properties | tail -n1)"
64+
if [[ -z "${MOD_VERSION}" ]]; then
65+
echo "Could not read mod_version from gradle.properties" >&2
66+
exit 1
67+
fi
68+
if [[ "${TAG_VERSION}" != "${MOD_VERSION}" ]]; then
69+
echo "Tag version (${TAG_VERSION}) does not match mod_version (${MOD_VERSION})." >&2
70+
exit 1
71+
fi
72+
73+
- name: Build changelog file
74+
run: |
75+
set -euo pipefail
76+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] && [[ -n "${{ inputs.changelog }}" ]]; then
77+
printf "%s\n" "${{ inputs.changelog }}" > .release-changelog.md
78+
exit 0
79+
fi
80+
81+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
82+
TAG_MSG="$(git for-each-ref "refs/tags/${GITHUB_REF_NAME}" --format='%(contents)')"
83+
if [[ -n "${TAG_MSG}" ]]; then
84+
printf "%s\n" "${TAG_MSG}" > .release-changelog.md
85+
exit 0
86+
fi
87+
fi
88+
89+
printf "Automated release from GitHub Actions.\n" > .release-changelog.md
90+
91+
- name: Publish to Modrinth
92+
env:
93+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
94+
MODRINTH_VERSION_TYPE: ${{ inputs.version_type || 'release' }}
95+
MODRINTH_STATUS: ${{ inputs.status || 'listed' }}
96+
MODRINTH_FEATURED: ${{ inputs.featured || false }}
97+
run: |
98+
set -euo pipefail
99+
if [[ -z "${MODRINTH_TOKEN}" ]]; then
100+
echo "Missing MODRINTH_TOKEN secret." >&2
101+
exit 1
102+
fi
103+
scripts/publish_modrinth.sh --changelog-file .release-changelog.md

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
This is a Minecraft Fabric mod called "Safeserver" that adds mandatory password authentication to Minecraft servers. It's built using Java 21 and Fabric API, targeting Minecraft 1.21.8.
7+
This is a Minecraft Fabric mod called "Safeserver" that adds mandatory password authentication to Minecraft servers. It's built using Java 21 and Fabric API, targeting Minecraft 1.21.11.
88

99
## Development Commands
1010

@@ -75,4 +75,4 @@ This is a Minecraft Fabric mod called "Safeserver" that adds mandatory password
7575

7676
## Testing
7777

78-
Run the server with `./gradlew runServer` to test authentication flow. The mod automatically creates necessary directories and configuration files on first run.
78+
Run the server with `./gradlew runServer` to test authentication flow. The mod automatically creates necessary directories and configuration files on first run.

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,48 @@ A simple Fabric mod for Minecraft that adds mandatory password authentication to
3737
3. Place the JAR file into your server's `mods` folder.
3838
4. Restart your server.
3939

40-
The mod will automatically generate the necessary configuration file upon first load.
40+
The mod will automatically generate the necessary configuration file upon first load.
41+
42+
## Publishing to Modrinth
43+
44+
Use `scripts/publish_modrinth.sh` to build and publish a new version to Modrinth automatically.
45+
46+
1. Create a Modrinth PAT with `VERSION_CREATE` scope.
47+
2. Export it in your shell:
48+
`export MODRINTH_TOKEN=your_token_here`
49+
3. Run one of:
50+
- Publish current `mod_version` from `gradle.properties`:
51+
`scripts/publish_modrinth.sh --changelog-text "Bug fixes and improvements"`
52+
- Bump version and publish:
53+
`scripts/publish_modrinth.sh --version 2.0.4 --set-version --changelog-file CHANGELOG.md`
54+
55+
Useful flags:
56+
- `--game-versions "1.21.11"` to override targeted MC versions
57+
- `--loaders "fabric"` to set loaders
58+
- `--sources-jar build/libs/safeserver-2.0.4-sources.jar` to override detected sources jar
59+
- `--version-type release|beta|alpha`
60+
- `--status listed|unlisted|draft|archived`
61+
- `--featured true|false`
62+
- `--skip-build` if you already built the jar
63+
64+
Defaults:
65+
- Project: `safeserver`
66+
- API: `https://api.modrinth.com/v2`
67+
- Loader: `fabric`
68+
- Game version: read from `gradle.properties` (`minecraft_version`)
69+
- Uploads both main and sources jars in the same Modrinth version
70+
71+
### GitHub Actions Auto Publish
72+
73+
This repo now includes `.github/workflows/release-modrinth.yml`.
74+
75+
Setup:
76+
1. Add repository secret `MODRINTH_TOKEN` (PAT with `VERSION_CREATE` scope).
77+
2. Keep `gradle.properties` `mod_version` in sync with your release tag.
78+
79+
Release flow:
80+
1. Commit your release changes (including `mod_version` bump).
81+
2. Create and push a tag matching the version:
82+
`git tag v2.0.4`
83+
`git push origin v2.0.4`
84+
3. Workflow builds and publishes to Modrinth automatically.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.10-SNAPSHOT'
2+
id 'fabric-loom' version '1.15.3'
33
id 'maven-publish'
44
}
55

@@ -93,4 +93,4 @@ publishing {
9393
// The repositories here will be used for publishing your artifact, not for
9494
// retrieving dependencies.
9595
}
96-
}
96+
}

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.21.8
8-
yarn_mappings=1.21.8+build.1
9-
loader_version=0.16.14
7+
minecraft_version=1.21.11
8+
yarn_mappings=1.21.11+build.4
9+
loader_version=0.18.4
1010

1111
# Mod Properties
12-
mod_version=2.0.3
12+
mod_version=2.0.4
1313
maven_group=youraveragedev.safeserver
1414
archives_base_name=safeserver
1515

1616
# Dependencies
17-
fabric_version=0.130.0+1.21.8
17+
fabric_version=0.141.3+1.21.11

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)