Skip to content

Release to CurseForge and Modrinth #35

Release to CurseForge and Modrinth

Release to CurseForge and Modrinth #35

Workflow file for this run

name: Release to CurseForge and Modrinth
on:
release:
types: [created, published]
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag to process (e.g., v1.20.4)'
required: false
type: string
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# If workflow_dispatch, checkout the tag
ref: ${{ github.event.inputs.release_tag || github.ref }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Build with Maven
run: mvn clean package -DskipTests
- name: Get artifact info
id: artifact
run: |
# For workflow_dispatch, use the input tag, otherwise use the ref name
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.release_tag }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
VERSION="${VERSION#v}" # Remove 'v' prefix if present
echo "jar_path=$(find target/ -name 'MinecraftServerAPI-*.jar' | head -n 1)" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Processing version: ${VERSION}"
- name: Extract game version from branch or tag
id: game_version
run: |
# Get the version for game-versions field
VERSION="${{ steps.artifact.outputs.version }}"
# Extract just the Minecraft version (e.g., 1.20.4 from v1.20.4)
MC_VERSION=$(echo "$VERSION" | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?')
echo "minecraft_version=${MC_VERSION}" >> $GITHUB_OUTPUT
echo "Minecraft version: ${MC_VERSION}"
- name: Upload to Modrinth & Curseforge
uses: Kir-Antipov/mc-publish@v3.3
with:
modrinth-id: H4i6sdRk
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 1101540
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
files: ${{ steps.artifact.outputs.jar_path }}
name: MinecraftServerAPI ${{ steps.artifact.outputs.version }}
version: msa-${{ steps.artifact.outputs.version }}
version-type: release
game-versions: |
${{ steps.game_version.outputs.minecraft_version }}
loaders: |
paper
spigot
bukkit
changelog: |
## MinecraftServerAPI v${{ steps.artifact.outputs.version }}
### Changes
- Rebased on latest master branch
- Includes all current features and bugfixes
### Minecraft Version
Supports Minecraft ${{ steps.game_version.outputs.minecraft_version }}
### Installation
Download the JAR file and place it in your Minecraft server's `plugins` folder.
For full documentation, see: https://github.com/${{ github.repository }}