Skip to content

Commit fccdd8c

Browse files
tastybentoclaude
andcommitted
Add Modrinth publish workflow
Mirrors the Level addon workflow: builds with the master profile to produce a non-SNAPSHOT jar named StrangerRealms-{version}.jar, then uploads to Modrinth via cloudnode-pro/modrinth-publish@v2. Triggers on GitHub Release publish, plus a manual workflow_dispatch for re-runs. Requires repo secrets MODRINTH_TOKEN (PAT with "Create versions" scope) and MODRINTH_PROJECT_ID. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 412c3e9 commit fccdd8c

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish to Modrinth
2+
3+
# Triggers when you publish a GitHub Release
4+
on:
5+
release:
6+
types: [published]
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Release tag to publish (e.g. 1.0.4)'
11+
required: true
12+
type: string
13+
changelog:
14+
description: 'Changelog / release notes (markdown)'
15+
required: false
16+
type: string
17+
18+
jobs:
19+
publish:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
24+
steps:
25+
# 1. Check out the repository at the release tag
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
# 2. Set up Java 21 (required by StrangerRealms' build)
30+
- name: Set up Java 21
31+
uses: actions/setup-java@v4
32+
with:
33+
java-version: '21'
34+
distribution: 'temurin'
35+
36+
# 3. Cache Maven dependencies to speed up builds
37+
- name: Cache Maven packages
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.m2
41+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
42+
restore-keys: ${{ runner.os }}-m2
43+
44+
# 4. Build the JAR
45+
# GIT_BRANCH=origin/master activates the master profile in pom.xml,
46+
# which sets revision=${build.version} (no -SNAPSHOT suffix) and
47+
# clears build.number, producing StrangerRealms-{version}.jar.
48+
- name: Build with Maven
49+
run: mvn -B package --no-transfer-progress
50+
env:
51+
GIT_BRANCH: origin/master
52+
53+
# 5. Upload the JAR to Modrinth
54+
#
55+
# Prerequisites — add these secrets in your GitHub repo settings
56+
# (Settings → Secrets and variables → Actions):
57+
#
58+
# MODRINTH_TOKEN — personal access token from https://modrinth.com/settings/pats
59+
# (scope: "Create versions")
60+
# MODRINTH_PROJECT_ID — your Modrinth project ID, visible on your project page
61+
# under the three-dot menu ("Copy ID")
62+
#
63+
- name: Publish to Modrinth
64+
uses: cloudnode-pro/modrinth-publish@v2
65+
with:
66+
token: ${{ secrets.MODRINTH_TOKEN }}
67+
project: ${{ secrets.MODRINTH_PROJECT_ID }}
68+
69+
# Use the release tag, or the manually supplied tag when triggered via workflow_dispatch
70+
version: ${{ github.event.release.tag_name || inputs.tag }}
71+
72+
# Use the GitHub release body, or the manually supplied changelog for workflow_dispatch
73+
changelog: ${{ github.event.release.body || inputs.changelog }}
74+
75+
# Release channel — auto-detected from version string:
76+
# *-alpha → alpha, *-beta → beta, anything else → release
77+
# Override here if needed: release | beta | alpha
78+
# channel: release
79+
80+
# StrangerRealms is a BentoBox game mode add-on running on Paper/Purpur
81+
loaders: |-
82+
paper
83+
purpur
84+
85+
# Minecraft versions this release supports.
86+
# Update this list when you start supporting newer or older MC versions.
87+
game-versions: |-
88+
1.21.5
89+
1.21.6
90+
1.21.7
91+
1.21.8
92+
1.21.9
93+
1.21.10
94+
1.21.11
95+
26.1
96+
26.1.1
97+
98+
# Path to the built JAR — Maven produces StrangerRealms-{version}.jar in target/
99+
files: target/StrangerRealms-${{ github.event.release.tag_name || inputs.tag }}.jar

0 commit comments

Comments
 (0)