-
-
Notifications
You must be signed in to change notification settings - Fork 5
86 lines (72 loc) · 2.91 KB
/
release.yml
File metadata and controls
86 lines (72 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release to CurseForge and Modrinth
on:
# Only trigger manually to avoid duplicate runs
# GitHub CLI releases don't reliably trigger workflows anyway
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag to process (e.g., v1.20.4)'
required: true
type: string
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Checkout the specified tag
ref: ${{ github.event.inputs.release_tag }}
- 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: |
# Use the input tag
VERSION="${{ github.event.inputs.release_tag }}"
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 }}