1818 java-version : ' 17'
1919 cache : ' maven'
2020
21- - name : Extract branch name and determine Minecraft version
22- id : extract_branch
23- run : |
24- BRANCH_NAME=${GITHUB_REF_NAME}
25- echo "Branch name: $BRANCH_NAME"
26-
27- # Extract Minecraft version from branch name (e.g., 1.19.x -> 1.19)
28- if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+)\.x ]]; then
29- MC_VERSION=${BASH_REMATCH[1]}
30- echo "Detected Minecraft version: $MC_VERSION"
31- echo "mc_version=$MC_VERSION" >> $GITHUB_OUTPUT
32-
33- # Create a list of compatible game versions based on the branch
34- if [[ $MC_VERSION == "1.19" ]]; then
35- echo "game_versions=1.19,1.19.1,1.19.2,1.19.3,1.19.4" >> $GITHUB_OUTPUT
36- elif [[ $MC_VERSION == "1.20" ]]; then
37- echo "game_versions=1.20,1.20.1,1.20.2,1.20.3,1.20.4" >> $GITHUB_OUTPUT
38- elif [[ $MC_VERSION == "1.21" ]]; then
39- echo "game_versions=1.21,1.21.1" >> $GITHUB_OUTPUT
40- elif [[ $MC_VERSION == "1.18" ]]; then
41- echo "game_versions=1.18,1.18.1,1.18.2" >> $GITHUB_OUTPUT
42- else
43- # For other versions, use the exact version and ensure it's not empty
44- echo "game_versions=$MC_VERSION" >> $GITHUB_OUTPUT
45- # Add a fallback in case the version extraction fails
46- if [[ -z "$MC_VERSION" ]]; then
47- echo "Fallback to a default version"
48- echo "game_versions=1.19,1.20,1.21" >> $GITHUB_OUTPUT
49- fi
50- fi
51-
52- # Store the game versions for debugging
53- GAME_VERSIONS=$(grep -oP 'game_versions=\K.*' $GITHUB_OUTPUT)
54- echo "Compatible game versions: $GAME_VERSIONS"
55- else
56- echo "Could not determine Minecraft version from branch name: $BRANCH_NAME"
57- exit 1
58- fi
59-
6021 - name : Build with Maven
6122 run : mvn clean package -DskipTests
6223
@@ -77,13 +38,21 @@ jobs:
7738
7839 files : ${{ steps.artifact.outputs.jar_path }}
7940
80- name : MinecraftServerAPI ${GITHUB_REF_NAME }
81- version : ${GITHUB_REF_NAME} -${{ steps.artifact.outputs.version }}
41+ name : MinecraftServerAPI ${{ github.ref_name } }
42+ version : msa -${{ steps.artifact.outputs.version }}
8243 version-type : release
83- game-versions : ${{ steps.extract_branch.outputs.game_versions }}
44+ game-versions : |
45+ >=1.21
8446 loaders : |
8547 paper
8648 spigot
8749 bukkit
8850 changelog : |
89- See [GitHub Release](${{ github.event.release.html_url }}) for changelog.
51+ See [GitHub Release](${{ github.event.release.html_url }}) for changelog.
52+
53+ - name : Upload to release
54+ uses : softprops/action-gh-release@v1
55+ with :
56+ files : target/MinecraftServerAPI-*.jar
57+ env :
58+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments