Skip to content

Commit 785503c

Browse files
committed
Refactor release workflow to remove branch name extraction and simplify game version handling
1 parent c62b68b commit 785503c

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,6 @@ jobs:
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,9 +38,11 @@ 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
44+
game-versions: |
45+
>=1.19 <1.20
8346
loaders: |
8447
paper
8548
spigot

0 commit comments

Comments
 (0)